185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
wchar_t *zMbcs;
/* does oldpath exist? is it a dir or a file? */
zMbcs = fossil_utf8_to_filename(oldpath);
if (win32_stat(zMbcs, &stat) == 0){
if (stat.st_mode == S_IFDIR)
flags = SYMBOLIC_LINK_FLAG_DIRECTORY;
DeleteFile(newpath);
if (CreateSymbolicLink(newpath, oldpath, flags))
created = 1;
}
fossil_filename_free(zMbcs);
/* if the symlink was not created, create a plain text file */
if (!created){
Blob content;
blob_set(&content, oldpath);
blob_write_to_file(&content, newpath);
blob_reset(&content);
|
>
>
>
>
>
>
>
>
>
|
<
<
>
>
>
|
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
wchar_t *zMbcs;
/* does oldpath exist? is it a dir or a file? */
zMbcs = fossil_utf8_to_filename(oldpath);
if (win32_stat(zMbcs, &stat) == 0){
if (stat.st_mode == S_IFDIR)
flags = SYMBOLIC_LINK_FLAG_DIRECTORY;
}
fossil_filename_free(zMbcs);
/* remove newpath before creating the symlink */
zMbcs = fossil_utf8_to_filename(newpath);
if (win32_stat(zMbcs, &stat) == 0){
if (stat.st_mode == S_IFDIR)
RemoveDirectory(newpath);
else
DeleteFile(newpath);
}
fossil_filename_free(zMbcs);
if (CreateSymbolicLink(newpath, oldpath, flags))
created = 1;
/* if the symlink was not created, create a plain text file */
if (!created){
Blob content;
blob_set(&content, oldpath);
blob_write_to_file(&content, newpath);
blob_reset(&content);
|