Fossil SCM
As it turns out that _wstati64() cannot handled the special "\\?\" prefix, work around that. Otherwise the win32-longpath VFS is quite useless for fossil. Maybe a better solution should be worked out, not using _wstati64() at all.
Commit
bb440899d387093de73c079c4565a811705e6f83
Parent
faa2e9d5cf16725…
1 file changed
+11
-1
+11
-1
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -74,11 +74,21 @@ | ||
| 74 | 74 | }else{ |
| 75 | 75 | rc = stat(zMbcs, buf); |
| 76 | 76 | } |
| 77 | 77 | #else |
| 78 | 78 | wchar_t *zMbcs = fossil_utf8_to_filename(zFilename); |
| 79 | - rc = _wstati64(zMbcs, buf); | |
| 79 | + if( memcmp(zMbcs, L"\\\\?\\", 8)==0 ){ | |
| 80 | + /* Unfortunately, _wstati64 cannot handle extended prefixes. */ | |
| 81 | + if( memcmp(zMbcs+4, "UNC\\", 8)==0 ){ | |
| 82 | + zMbcs[6] = '\\'; | |
| 83 | + rc = _wstati64(zMbcs+6, buf); | |
| 84 | + }else{ | |
| 85 | + rc = _wstati64(zMbcs+4, buf); | |
| 86 | + } | |
| 87 | + }else{ | |
| 88 | + rc = _wstati64(zMbcs, buf); | |
| 89 | + } | |
| 80 | 90 | #endif |
| 81 | 91 | fossil_filename_free(zMbcs); |
| 82 | 92 | return rc; |
| 83 | 93 | } |
| 84 | 94 | |
| 85 | 95 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -74,11 +74,21 @@ | |
| 74 | }else{ |
| 75 | rc = stat(zMbcs, buf); |
| 76 | } |
| 77 | #else |
| 78 | wchar_t *zMbcs = fossil_utf8_to_filename(zFilename); |
| 79 | rc = _wstati64(zMbcs, buf); |
| 80 | #endif |
| 81 | fossil_filename_free(zMbcs); |
| 82 | return rc; |
| 83 | } |
| 84 | |
| 85 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -74,11 +74,21 @@ | |
| 74 | }else{ |
| 75 | rc = stat(zMbcs, buf); |
| 76 | } |
| 77 | #else |
| 78 | wchar_t *zMbcs = fossil_utf8_to_filename(zFilename); |
| 79 | if( memcmp(zMbcs, L"\\\\?\\", 8)==0 ){ |
| 80 | /* Unfortunately, _wstati64 cannot handle extended prefixes. */ |
| 81 | if( memcmp(zMbcs+4, "UNC\\", 8)==0 ){ |
| 82 | zMbcs[6] = '\\'; |
| 83 | rc = _wstati64(zMbcs+6, buf); |
| 84 | }else{ |
| 85 | rc = _wstati64(zMbcs+4, buf); |
| 86 | } |
| 87 | }else{ |
| 88 | rc = _wstati64(zMbcs, buf); |
| 89 | } |
| 90 | #endif |
| 91 | fossil_filename_free(zMbcs); |
| 92 | return rc; |
| 93 | } |
| 94 | |
| 95 |