Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fixed a problem with the high level symlink creation code to accommodate windows drive letters. Also modified windows symlink creation logic to better handle dir/file symlinks. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | bad-winsymlink |
Files: | files | file ages | folders |
SHA1: |
1f1f75066a2e4a3dd24d97d4f5e3493d |
User & Date: | sdr 2014-09-20 16:50:01 |
Context
2014-09-20
| ||
18:11 | Modified revert to always process symbolic links. Also added link_delete to complement file_delete, as windows needs special delete handling for symbolic links as they might be directory symlinks. check-in: 9e0ba1215d user: sdr tags: bad-winsymlink | |
16:50 | Fixed a problem with the high level symlink creation code to accommodate windows drive letters. Also modified windows symlink creation logic to better handle dir/file symlinks. check-in: 1f1f75066a user: sdr tags: bad-winsymlink | |
15:28 | Merged updates from trunk. check-in: e2c5960617 user: sdr tags: bad-winsymlink | |
Changes
Changes to src/file.c.
︙ | ︙ | |||
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | zName = zBuf; memcpy(zName, zLinkFile, nName+1); } nName = file_simplify_name(zName, nName, 0); for(i=1; i<nName; i++){ if( zName[i]=='/' ){ zName[i] = 0; if( file_mkdir(zName, 1) ){ fossil_fatal_recursive("unable to create directory %s", zName); return; } zName[i] = '/'; } } #if !defined(_WIN32) if( symlink(zTargetFile, zName)!=0 ) #else if( win32_symlink(zTargetFile, zName)!=0 ) | > > > > > > > > > > > | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | zName = zBuf; memcpy(zName, zLinkFile, nName+1); } nName = file_simplify_name(zName, nName, 0); for(i=1; i<nName; i++){ if( zName[i]=='/' ){ zName[i] = 0; #if defined(_WIN32) || defined(__CYGWIN__) /* ** On Windows, local path looks like: C:/develop/project/file.txt ** The if stops us from trying to create a directory of a drive letter ** C: in this example. */ if (!(i == 2 && zName[1] == ':')){ #endif if( file_mkdir(zName, 1) ){ fossil_fatal_recursive("unable to create directory %s", zName); return; } #if defined(_WIN32) || defined(__CYGWIN__) } #endif zName[i] = '/'; } } #if !defined(_WIN32) if( symlink(zTargetFile, zName)!=0 ) #else if( win32_symlink(zTargetFile, zName)!=0 ) |
︙ | ︙ |
Changes to src/winfile.c.
︙ | ︙ | |||
185 186 187 188 189 190 191 | 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; | > > > > > > > > > | < < > > > | 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); |
︙ | ︙ |