Fossil

Check-in [04f4e699]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:If "fossil new" or "fossil open"'s argument has an extended path prefix like "\\?\C:\", don't process the '?' and ':' in it as special path characters, only do '/' -> '\' translation. This makes extended paths usable in fossil everywhere (hopefully), for now <260.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | win32-longpath
Files: files | file ages | folders
SHA1:04f4e699d41b7378ce8cb5d4c09bc0756a818fb0
User & Date: jan.nijtmans 2013-12-17 09:32:35
Context
2013-12-17
10:20
Break the 260 character path barrier on Win32. Add test-case "win32-longpath" for proving that it works. check-in: 4b49bb9c user: jan.nijtmans tags: win32-longpath
10:14
Move special path handling from SQLite to fossil. check-in: 1dd5a509 user: jan.nijtmans tags: win32-longpath
09:32
If "fossil new" or "fossil open"'s argument has an extended path prefix like "\\?\C:\", don't process the '?' and ':' in it as special path characters, only do '/' -> '\' translation. This makes extended paths usable in fossil everywhere (hopefully), for now <260. check-in: 04f4e699 user: jan.nijtmans tags: win32-longpath
06:04
Change the minimum length for wiki page names from 3 to 1. check-in: b7ff13a0 user: joel tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/utf8.c.

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
214
**
** See: <http://cygwin.com/cygwin-ug-net/using-specialnames.html>
**
*/
void *fossil_utf8_to_filename(const char *zUtf8){
#ifdef _WIN32
  int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
  wchar_t *zUnicode = sqlite3_malloc( nChar * 2 );
  wchar_t *wUnicode = zUnicode;
  if( zUnicode==0 ){
    return 0;
  }
  MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar);
  /* If path starts with "<drive>:/" or "<drive>:\", don't translate the ':' */
  if( fossil_isalpha(zUtf8[0]) && zUtf8[1]==':'
           && (zUtf8[2]=='\\' || zUtf8[2]=='/')) {

    zUnicode[2] = '\\';

    wUnicode += 3;











  }



  while( *wUnicode != '\0' ){
    if ( (*wUnicode < ' ') || wcschr(L"\"*:<>?|", *wUnicode) ){
      *wUnicode |= 0xF000;
    }else if( *wUnicode == '/' ){
      *wUnicode = '\\';
    }
    ++wUnicode;







|




<
<


>
|
>

>
>
>
>
>
>
>
>
>
>
>
|
>
>
>







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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
**
** See: <http://cygwin.com/cygwin-ug-net/using-specialnames.html>
**
*/
void *fossil_utf8_to_filename(const char *zUtf8){
#ifdef _WIN32
  int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
  wchar_t *zUnicode = sqlite3_malloc( nChar * sizeof(wchar_t) );
  wchar_t *wUnicode = zUnicode;
  if( zUnicode==0 ){
    return 0;
  }


  if( fossil_isalpha(zUtf8[0]) && zUtf8[1]==':'
           && (zUtf8[2]=='\\' || zUtf8[2]=='/')) {
    /* If path starts with "<drive>:[/\]", don't process the ':' */
    zUnicode[0] = zUtf8[0];
    memcpy(&zUnicode[1], L":\\", 2 * sizeof(wchar_t)); 
    wUnicode += 3;
    MultiByteToWideChar(CP_UTF8, 0, zUtf8+3, -1, wUnicode, nChar-3);
    goto finish;
  }else if( (zUtf8[0]=='\\' || zUtf8[0]=='/') &&
      (zUtf8[1]=='\\' || zUtf8[1]=='/') ) {
    if( zUtf8[2]=='?' && nChar>5 ){
      /* Don't postprocess [?:] in extended path, but do '/' -> '\' */
      memcpy(zUnicode, L"\\\\", 2 * sizeof(wchar_t)); 
      MultiByteToWideChar(CP_UTF8, 0, zUtf8+2, -1, zUnicode+2, nChar-2);
      if( zUtf8[3]=='/' ) zUnicode[3]='\\';
      wUnicode += 6;
      goto finish;
    }
  }
  MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar);
finish:
  while( *wUnicode != '\0' ){
    if ( (*wUnicode < ' ') || wcschr(L"\"*:<>?|", *wUnicode) ){
      *wUnicode |= 0xF000;
    }else if( *wUnicode == '/' ){
      *wUnicode = '\\';
    }
    ++wUnicode;