Fossil SCM
Win32: Fossil now understands Cygwin paths containing one or more of the characters <nowiki>"*:<>?|</nowiki>. Those are normally forbidden in win32. This means that the win32 fossil.exe is better usable in a Cygwin environment. See [http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars].
Commit
fc413110eb990d28bc8340b7c209babd1295513c
Parent
3f78dfe593630c2…
6 files changed
+1
-1
+1
-1
+38
-1
+38
-1
+5
+5
M
src/db.c
+1
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2179,11 +2179,11 @@ | ||
| 2179 | 2179 | ** for committing and merging purposes. Example: *.jpg |
| 2180 | 2180 | ** |
| 2181 | 2181 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2182 | 2182 | ** care considered distinct. If FALSE files whose names |
| 2183 | 2183 | ** differ only in case are the same file. Defaults to |
| 2184 | -** TRUE for unix and FALSE for windows and mac. | |
| 2184 | +** TRUE for unix and FALSE for Cygwin, Mac and Windows. | |
| 2185 | 2185 | ** |
| 2186 | 2186 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2187 | 2187 | ** with gpg. When disabled (the default), commits will |
| 2188 | 2188 | ** be unsigned. Default: off |
| 2189 | 2189 | ** |
| 2190 | 2190 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2179,11 +2179,11 @@ | |
| 2179 | ** for committing and merging purposes. Example: *.jpg |
| 2180 | ** |
| 2181 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2182 | ** care considered distinct. If FALSE files whose names |
| 2183 | ** differ only in case are the same file. Defaults to |
| 2184 | ** TRUE for unix and FALSE for windows and mac. |
| 2185 | ** |
| 2186 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2187 | ** with gpg. When disabled (the default), commits will |
| 2188 | ** be unsigned. Default: off |
| 2189 | ** |
| 2190 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2179,11 +2179,11 @@ | |
| 2179 | ** for committing and merging purposes. Example: *.jpg |
| 2180 | ** |
| 2181 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2182 | ** care considered distinct. If FALSE files whose names |
| 2183 | ** differ only in case are the same file. Defaults to |
| 2184 | ** TRUE for unix and FALSE for Cygwin, Mac and Windows. |
| 2185 | ** |
| 2186 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2187 | ** with gpg. When disabled (the default), commits will |
| 2188 | ** be unsigned. Default: off |
| 2189 | ** |
| 2190 |
M
src/db.c
+1
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2179,11 +2179,11 @@ | ||
| 2179 | 2179 | ** for committing and merging purposes. Example: *.jpg |
| 2180 | 2180 | ** |
| 2181 | 2181 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2182 | 2182 | ** care considered distinct. If FALSE files whose names |
| 2183 | 2183 | ** differ only in case are the same file. Defaults to |
| 2184 | -** TRUE for unix and FALSE for windows and mac. | |
| 2184 | +** TRUE for unix and FALSE for Cygwin, Mac and Windows. | |
| 2185 | 2185 | ** |
| 2186 | 2186 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2187 | 2187 | ** with gpg. When disabled (the default), commits will |
| 2188 | 2188 | ** be unsigned. Default: off |
| 2189 | 2189 | ** |
| 2190 | 2190 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2179,11 +2179,11 @@ | |
| 2179 | ** for committing and merging purposes. Example: *.jpg |
| 2180 | ** |
| 2181 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2182 | ** care considered distinct. If FALSE files whose names |
| 2183 | ** differ only in case are the same file. Defaults to |
| 2184 | ** TRUE for unix and FALSE for windows and mac. |
| 2185 | ** |
| 2186 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2187 | ** with gpg. When disabled (the default), commits will |
| 2188 | ** be unsigned. Default: off |
| 2189 | ** |
| 2190 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2179,11 +2179,11 @@ | |
| 2179 | ** for committing and merging purposes. Example: *.jpg |
| 2180 | ** |
| 2181 | ** case-sensitive If TRUE, the files whose names differ only in case |
| 2182 | ** care considered distinct. If FALSE files whose names |
| 2183 | ** differ only in case are the same file. Defaults to |
| 2184 | ** TRUE for unix and FALSE for Cygwin, Mac and Windows. |
| 2185 | ** |
| 2186 | ** clearsign When enabled, fossil will attempt to sign all commits |
| 2187 | ** with gpg. When disabled (the default), commits will |
| 2188 | ** be unsigned. Default: off |
| 2189 | ** |
| 2190 |
+38
-1
| --- src/utf8.c | ||
| +++ src/utf8.c | ||
| @@ -116,19 +116,37 @@ | ||
| 116 | 116 | ** returned pointer when done. |
| 117 | 117 | ** |
| 118 | 118 | ** This function must not convert '\' to '/' on windows/cygwin, as it is |
| 119 | 119 | ** used in places where we are not sure it's really filenames we are handling, |
| 120 | 120 | ** e.g. fossil_getenv() or handling the argv arguments from main(). |
| 121 | +** | |
| 122 | +** On Windows, translate some characters in the in the range | |
| 123 | +** U+F001 - U+F07F (private use area) to ASCII. Cygwin sometimes | |
| 124 | +** generates such filenames. See: | |
| 125 | +** <http://cygwin.com/cygwin-ug-net/using-specialnames.html> | |
| 121 | 126 | */ |
| 122 | 127 | char *fossil_filename_to_utf8(const void *zFilename){ |
| 123 | 128 | #if defined(_WIN32) |
| 124 | 129 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, 0, 0, 0, 0); |
| 125 | 130 | char *zUtf = sqlite3_malloc( nByte ); |
| 131 | + char *pUtf, *qUtf; | |
| 126 | 132 | if( zUtf==0 ){ |
| 127 | 133 | return 0; |
| 128 | 134 | } |
| 129 | 135 | WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, zUtf, nByte, 0, 0); |
| 136 | + pUtf = qUtf = zUtf; | |
| 137 | + while( *pUtf ) { | |
| 138 | + if( *pUtf == (char)0xef ){ | |
| 139 | + wchar_t c = ((pUtf[1]&0x3f)<<6)|(pUtf[2]&0x3f); | |
| 140 | + /* Only really convert it when the resulting char is in range. */ | |
| 141 | + if ( c && ((c < ' ') || wcschr(L"\"*:<>?|", c)) ){ | |
| 142 | + *qUtf++ = c; pUtf+=3; continue; | |
| 143 | + } | |
| 144 | + } | |
| 145 | + *qUtf++ = *pUtf++; | |
| 146 | + } | |
| 147 | + *qUtf = 0; | |
| 130 | 148 | return zUtf; |
| 131 | 149 | #elif defined(__CYGWIN__) |
| 132 | 150 | char *zOut; |
| 133 | 151 | zOut = fossil_strdup(zFilename); |
| 134 | 152 | return zOut; |
| @@ -165,10 +183,21 @@ | ||
| 165 | 183 | /* |
| 166 | 184 | ** Translate text from UTF-8 to the filename character set. |
| 167 | 185 | ** Return a pointer to the translated text. |
| 168 | 186 | ** Call fossil_filename_free() to deallocate any memory used to store the |
| 169 | 187 | ** returned pointer when done. |
| 188 | +** | |
| 189 | +** On Windows, characters in the range U+0001 to U+0031 and the | |
| 190 | +** characters '"', '*', ':', '<', '>', '?' and '|' are invalid | |
| 191 | +** to be used. Therefore, translate those to characters in the | |
| 192 | +** in the range U+F001 - U+F07F (private use area), so those | |
| 193 | +** characters never arrive in any Windows API. The filenames might | |
| 194 | +** look strange in Windows explorer, but in the cygwin shell | |
| 195 | +** everything looks as expected. | |
| 196 | +** | |
| 197 | +** See: <http://cygwin.com/cygwin-ug-net/using-specialnames.html> | |
| 198 | +** | |
| 170 | 199 | */ |
| 171 | 200 | void *fossil_utf8_to_filename(const char *zUtf8){ |
| 172 | 201 | #ifdef _WIN32 |
| 173 | 202 | int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 174 | 203 | wchar_t *zUnicode = sqlite3_malloc( nChar * 2 ); |
| @@ -175,12 +204,20 @@ | ||
| 175 | 204 | wchar_t *wUnicode = zUnicode; |
| 176 | 205 | if( zUnicode==0 ){ |
| 177 | 206 | return 0; |
| 178 | 207 | } |
| 179 | 208 | MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar); |
| 209 | + /* If path starts with "<drive>:/" or "<drive>:\", don't translate the ':' */ | |
| 210 | + if( fossil_isalpha(zUtf8[0]) && zUtf8[1]==':' | |
| 211 | + && (zUtf8[2]=='\\' || zUtf8[2]=='/')) { | |
| 212 | + zUnicode[2] = '\\'; | |
| 213 | + wUnicode += 3; | |
| 214 | + } | |
| 180 | 215 | while( *wUnicode != '\0' ){ |
| 181 | - if( *wUnicode == '/' ){ | |
| 216 | + if ( (*wUnicode < ' ') || wcschr(L"\"*:<>?|", *wUnicode) ){ | |
| 217 | + *wUnicode |= 0xF000; | |
| 218 | + }else if( *wUnicode == '/' ){ | |
| 182 | 219 | *wUnicode = '\\'; |
| 183 | 220 | } |
| 184 | 221 | ++wUnicode; |
| 185 | 222 | } |
| 186 | 223 | return zUnicode; |
| 187 | 224 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -116,19 +116,37 @@ | |
| 116 | ** returned pointer when done. |
| 117 | ** |
| 118 | ** This function must not convert '\' to '/' on windows/cygwin, as it is |
| 119 | ** used in places where we are not sure it's really filenames we are handling, |
| 120 | ** e.g. fossil_getenv() or handling the argv arguments from main(). |
| 121 | */ |
| 122 | char *fossil_filename_to_utf8(const void *zFilename){ |
| 123 | #if defined(_WIN32) |
| 124 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, 0, 0, 0, 0); |
| 125 | char *zUtf = sqlite3_malloc( nByte ); |
| 126 | if( zUtf==0 ){ |
| 127 | return 0; |
| 128 | } |
| 129 | WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, zUtf, nByte, 0, 0); |
| 130 | return zUtf; |
| 131 | #elif defined(__CYGWIN__) |
| 132 | char *zOut; |
| 133 | zOut = fossil_strdup(zFilename); |
| 134 | return zOut; |
| @@ -165,10 +183,21 @@ | |
| 165 | /* |
| 166 | ** Translate text from UTF-8 to the filename character set. |
| 167 | ** Return a pointer to the translated text. |
| 168 | ** Call fossil_filename_free() to deallocate any memory used to store the |
| 169 | ** returned pointer when done. |
| 170 | */ |
| 171 | void *fossil_utf8_to_filename(const char *zUtf8){ |
| 172 | #ifdef _WIN32 |
| 173 | int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 174 | wchar_t *zUnicode = sqlite3_malloc( nChar * 2 ); |
| @@ -175,12 +204,20 @@ | |
| 175 | wchar_t *wUnicode = zUnicode; |
| 176 | if( zUnicode==0 ){ |
| 177 | return 0; |
| 178 | } |
| 179 | MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar); |
| 180 | while( *wUnicode != '\0' ){ |
| 181 | if( *wUnicode == '/' ){ |
| 182 | *wUnicode = '\\'; |
| 183 | } |
| 184 | ++wUnicode; |
| 185 | } |
| 186 | return zUnicode; |
| 187 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -116,19 +116,37 @@ | |
| 116 | ** returned pointer when done. |
| 117 | ** |
| 118 | ** This function must not convert '\' to '/' on windows/cygwin, as it is |
| 119 | ** used in places where we are not sure it's really filenames we are handling, |
| 120 | ** e.g. fossil_getenv() or handling the argv arguments from main(). |
| 121 | ** |
| 122 | ** On Windows, translate some characters in the in the range |
| 123 | ** U+F001 - U+F07F (private use area) to ASCII. Cygwin sometimes |
| 124 | ** generates such filenames. See: |
| 125 | ** <http://cygwin.com/cygwin-ug-net/using-specialnames.html> |
| 126 | */ |
| 127 | char *fossil_filename_to_utf8(const void *zFilename){ |
| 128 | #if defined(_WIN32) |
| 129 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, 0, 0, 0, 0); |
| 130 | char *zUtf = sqlite3_malloc( nByte ); |
| 131 | char *pUtf, *qUtf; |
| 132 | if( zUtf==0 ){ |
| 133 | return 0; |
| 134 | } |
| 135 | WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, zUtf, nByte, 0, 0); |
| 136 | pUtf = qUtf = zUtf; |
| 137 | while( *pUtf ) { |
| 138 | if( *pUtf == (char)0xef ){ |
| 139 | wchar_t c = ((pUtf[1]&0x3f)<<6)|(pUtf[2]&0x3f); |
| 140 | /* Only really convert it when the resulting char is in range. */ |
| 141 | if ( c && ((c < ' ') || wcschr(L"\"*:<>?|", c)) ){ |
| 142 | *qUtf++ = c; pUtf+=3; continue; |
| 143 | } |
| 144 | } |
| 145 | *qUtf++ = *pUtf++; |
| 146 | } |
| 147 | *qUtf = 0; |
| 148 | return zUtf; |
| 149 | #elif defined(__CYGWIN__) |
| 150 | char *zOut; |
| 151 | zOut = fossil_strdup(zFilename); |
| 152 | return zOut; |
| @@ -165,10 +183,21 @@ | |
| 183 | /* |
| 184 | ** Translate text from UTF-8 to the filename character set. |
| 185 | ** Return a pointer to the translated text. |
| 186 | ** Call fossil_filename_free() to deallocate any memory used to store the |
| 187 | ** returned pointer when done. |
| 188 | ** |
| 189 | ** On Windows, characters in the range U+0001 to U+0031 and the |
| 190 | ** characters '"', '*', ':', '<', '>', '?' and '|' are invalid |
| 191 | ** to be used. Therefore, translate those to characters in the |
| 192 | ** in the range U+F001 - U+F07F (private use area), so those |
| 193 | ** characters never arrive in any Windows API. The filenames might |
| 194 | ** look strange in Windows explorer, but in the cygwin shell |
| 195 | ** everything looks as expected. |
| 196 | ** |
| 197 | ** See: <http://cygwin.com/cygwin-ug-net/using-specialnames.html> |
| 198 | ** |
| 199 | */ |
| 200 | void *fossil_utf8_to_filename(const char *zUtf8){ |
| 201 | #ifdef _WIN32 |
| 202 | int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 203 | wchar_t *zUnicode = sqlite3_malloc( nChar * 2 ); |
| @@ -175,12 +204,20 @@ | |
| 204 | wchar_t *wUnicode = zUnicode; |
| 205 | if( zUnicode==0 ){ |
| 206 | return 0; |
| 207 | } |
| 208 | MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar); |
| 209 | /* If path starts with "<drive>:/" or "<drive>:\", don't translate the ':' */ |
| 210 | if( fossil_isalpha(zUtf8[0]) && zUtf8[1]==':' |
| 211 | && (zUtf8[2]=='\\' || zUtf8[2]=='/')) { |
| 212 | zUnicode[2] = '\\'; |
| 213 | wUnicode += 3; |
| 214 | } |
| 215 | while( *wUnicode != '\0' ){ |
| 216 | if ( (*wUnicode < ' ') || wcschr(L"\"*:<>?|", *wUnicode) ){ |
| 217 | *wUnicode |= 0xF000; |
| 218 | }else if( *wUnicode == '/' ){ |
| 219 | *wUnicode = '\\'; |
| 220 | } |
| 221 | ++wUnicode; |
| 222 | } |
| 223 | return zUnicode; |
| 224 |
+38
-1
| --- src/utf8.c | ||
| +++ src/utf8.c | ||
| @@ -116,19 +116,37 @@ | ||
| 116 | 116 | ** returned pointer when done. |
| 117 | 117 | ** |
| 118 | 118 | ** This function must not convert '\' to '/' on windows/cygwin, as it is |
| 119 | 119 | ** used in places where we are not sure it's really filenames we are handling, |
| 120 | 120 | ** e.g. fossil_getenv() or handling the argv arguments from main(). |
| 121 | +** | |
| 122 | +** On Windows, translate some characters in the in the range | |
| 123 | +** U+F001 - U+F07F (private use area) to ASCII. Cygwin sometimes | |
| 124 | +** generates such filenames. See: | |
| 125 | +** <http://cygwin.com/cygwin-ug-net/using-specialnames.html> | |
| 121 | 126 | */ |
| 122 | 127 | char *fossil_filename_to_utf8(const void *zFilename){ |
| 123 | 128 | #if defined(_WIN32) |
| 124 | 129 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, 0, 0, 0, 0); |
| 125 | 130 | char *zUtf = sqlite3_malloc( nByte ); |
| 131 | + char *pUtf, *qUtf; | |
| 126 | 132 | if( zUtf==0 ){ |
| 127 | 133 | return 0; |
| 128 | 134 | } |
| 129 | 135 | WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, zUtf, nByte, 0, 0); |
| 136 | + pUtf = qUtf = zUtf; | |
| 137 | + while( *pUtf ) { | |
| 138 | + if( *pUtf == (char)0xef ){ | |
| 139 | + wchar_t c = ((pUtf[1]&0x3f)<<6)|(pUtf[2]&0x3f); | |
| 140 | + /* Only really convert it when the resulting char is in range. */ | |
| 141 | + if ( c && ((c < ' ') || wcschr(L"\"*:<>?|", c)) ){ | |
| 142 | + *qUtf++ = c; pUtf+=3; continue; | |
| 143 | + } | |
| 144 | + } | |
| 145 | + *qUtf++ = *pUtf++; | |
| 146 | + } | |
| 147 | + *qUtf = 0; | |
| 130 | 148 | return zUtf; |
| 131 | 149 | #elif defined(__CYGWIN__) |
| 132 | 150 | char *zOut; |
| 133 | 151 | zOut = fossil_strdup(zFilename); |
| 134 | 152 | return zOut; |
| @@ -165,10 +183,21 @@ | ||
| 165 | 183 | /* |
| 166 | 184 | ** Translate text from UTF-8 to the filename character set. |
| 167 | 185 | ** Return a pointer to the translated text. |
| 168 | 186 | ** Call fossil_filename_free() to deallocate any memory used to store the |
| 169 | 187 | ** returned pointer when done. |
| 188 | +** | |
| 189 | +** On Windows, characters in the range U+0001 to U+0031 and the | |
| 190 | +** characters '"', '*', ':', '<', '>', '?' and '|' are invalid | |
| 191 | +** to be used. Therefore, translate those to characters in the | |
| 192 | +** in the range U+F001 - U+F07F (private use area), so those | |
| 193 | +** characters never arrive in any Windows API. The filenames might | |
| 194 | +** look strange in Windows explorer, but in the cygwin shell | |
| 195 | +** everything looks as expected. | |
| 196 | +** | |
| 197 | +** See: <http://cygwin.com/cygwin-ug-net/using-specialnames.html> | |
| 198 | +** | |
| 170 | 199 | */ |
| 171 | 200 | void *fossil_utf8_to_filename(const char *zUtf8){ |
| 172 | 201 | #ifdef _WIN32 |
| 173 | 202 | int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 174 | 203 | wchar_t *zUnicode = sqlite3_malloc( nChar * 2 ); |
| @@ -175,12 +204,20 @@ | ||
| 175 | 204 | wchar_t *wUnicode = zUnicode; |
| 176 | 205 | if( zUnicode==0 ){ |
| 177 | 206 | return 0; |
| 178 | 207 | } |
| 179 | 208 | MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar); |
| 209 | + /* If path starts with "<drive>:/" or "<drive>:\", don't translate the ':' */ | |
| 210 | + if( fossil_isalpha(zUtf8[0]) && zUtf8[1]==':' | |
| 211 | + && (zUtf8[2]=='\\' || zUtf8[2]=='/')) { | |
| 212 | + zUnicode[2] = '\\'; | |
| 213 | + wUnicode += 3; | |
| 214 | + } | |
| 180 | 215 | while( *wUnicode != '\0' ){ |
| 181 | - if( *wUnicode == '/' ){ | |
| 216 | + if ( (*wUnicode < ' ') || wcschr(L"\"*:<>?|", *wUnicode) ){ | |
| 217 | + *wUnicode |= 0xF000; | |
| 218 | + }else if( *wUnicode == '/' ){ | |
| 182 | 219 | *wUnicode = '\\'; |
| 183 | 220 | } |
| 184 | 221 | ++wUnicode; |
| 185 | 222 | } |
| 186 | 223 | return zUnicode; |
| 187 | 224 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -116,19 +116,37 @@ | |
| 116 | ** returned pointer when done. |
| 117 | ** |
| 118 | ** This function must not convert '\' to '/' on windows/cygwin, as it is |
| 119 | ** used in places where we are not sure it's really filenames we are handling, |
| 120 | ** e.g. fossil_getenv() or handling the argv arguments from main(). |
| 121 | */ |
| 122 | char *fossil_filename_to_utf8(const void *zFilename){ |
| 123 | #if defined(_WIN32) |
| 124 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, 0, 0, 0, 0); |
| 125 | char *zUtf = sqlite3_malloc( nByte ); |
| 126 | if( zUtf==0 ){ |
| 127 | return 0; |
| 128 | } |
| 129 | WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, zUtf, nByte, 0, 0); |
| 130 | return zUtf; |
| 131 | #elif defined(__CYGWIN__) |
| 132 | char *zOut; |
| 133 | zOut = fossil_strdup(zFilename); |
| 134 | return zOut; |
| @@ -165,10 +183,21 @@ | |
| 165 | /* |
| 166 | ** Translate text from UTF-8 to the filename character set. |
| 167 | ** Return a pointer to the translated text. |
| 168 | ** Call fossil_filename_free() to deallocate any memory used to store the |
| 169 | ** returned pointer when done. |
| 170 | */ |
| 171 | void *fossil_utf8_to_filename(const char *zUtf8){ |
| 172 | #ifdef _WIN32 |
| 173 | int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 174 | wchar_t *zUnicode = sqlite3_malloc( nChar * 2 ); |
| @@ -175,12 +204,20 @@ | |
| 175 | wchar_t *wUnicode = zUnicode; |
| 176 | if( zUnicode==0 ){ |
| 177 | return 0; |
| 178 | } |
| 179 | MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar); |
| 180 | while( *wUnicode != '\0' ){ |
| 181 | if( *wUnicode == '/' ){ |
| 182 | *wUnicode = '\\'; |
| 183 | } |
| 184 | ++wUnicode; |
| 185 | } |
| 186 | return zUnicode; |
| 187 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -116,19 +116,37 @@ | |
| 116 | ** returned pointer when done. |
| 117 | ** |
| 118 | ** This function must not convert '\' to '/' on windows/cygwin, as it is |
| 119 | ** used in places where we are not sure it's really filenames we are handling, |
| 120 | ** e.g. fossil_getenv() or handling the argv arguments from main(). |
| 121 | ** |
| 122 | ** On Windows, translate some characters in the in the range |
| 123 | ** U+F001 - U+F07F (private use area) to ASCII. Cygwin sometimes |
| 124 | ** generates such filenames. See: |
| 125 | ** <http://cygwin.com/cygwin-ug-net/using-specialnames.html> |
| 126 | */ |
| 127 | char *fossil_filename_to_utf8(const void *zFilename){ |
| 128 | #if defined(_WIN32) |
| 129 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, 0, 0, 0, 0); |
| 130 | char *zUtf = sqlite3_malloc( nByte ); |
| 131 | char *pUtf, *qUtf; |
| 132 | if( zUtf==0 ){ |
| 133 | return 0; |
| 134 | } |
| 135 | WideCharToMultiByte(CP_UTF8, 0, zFilename, -1, zUtf, nByte, 0, 0); |
| 136 | pUtf = qUtf = zUtf; |
| 137 | while( *pUtf ) { |
| 138 | if( *pUtf == (char)0xef ){ |
| 139 | wchar_t c = ((pUtf[1]&0x3f)<<6)|(pUtf[2]&0x3f); |
| 140 | /* Only really convert it when the resulting char is in range. */ |
| 141 | if ( c && ((c < ' ') || wcschr(L"\"*:<>?|", c)) ){ |
| 142 | *qUtf++ = c; pUtf+=3; continue; |
| 143 | } |
| 144 | } |
| 145 | *qUtf++ = *pUtf++; |
| 146 | } |
| 147 | *qUtf = 0; |
| 148 | return zUtf; |
| 149 | #elif defined(__CYGWIN__) |
| 150 | char *zOut; |
| 151 | zOut = fossil_strdup(zFilename); |
| 152 | return zOut; |
| @@ -165,10 +183,21 @@ | |
| 183 | /* |
| 184 | ** Translate text from UTF-8 to the filename character set. |
| 185 | ** Return a pointer to the translated text. |
| 186 | ** Call fossil_filename_free() to deallocate any memory used to store the |
| 187 | ** returned pointer when done. |
| 188 | ** |
| 189 | ** On Windows, characters in the range U+0001 to U+0031 and the |
| 190 | ** characters '"', '*', ':', '<', '>', '?' and '|' are invalid |
| 191 | ** to be used. Therefore, translate those to characters in the |
| 192 | ** in the range U+F001 - U+F07F (private use area), so those |
| 193 | ** characters never arrive in any Windows API. The filenames might |
| 194 | ** look strange in Windows explorer, but in the cygwin shell |
| 195 | ** everything looks as expected. |
| 196 | ** |
| 197 | ** See: <http://cygwin.com/cygwin-ug-net/using-specialnames.html> |
| 198 | ** |
| 199 | */ |
| 200 | void *fossil_utf8_to_filename(const char *zUtf8){ |
| 201 | #ifdef _WIN32 |
| 202 | int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 203 | wchar_t *zUnicode = sqlite3_malloc( nChar * 2 ); |
| @@ -175,12 +204,20 @@ | |
| 204 | wchar_t *wUnicode = zUnicode; |
| 205 | if( zUnicode==0 ){ |
| 206 | return 0; |
| 207 | } |
| 208 | MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar); |
| 209 | /* If path starts with "<drive>:/" or "<drive>:\", don't translate the ':' */ |
| 210 | if( fossil_isalpha(zUtf8[0]) && zUtf8[1]==':' |
| 211 | && (zUtf8[2]=='\\' || zUtf8[2]=='/')) { |
| 212 | zUnicode[2] = '\\'; |
| 213 | wUnicode += 3; |
| 214 | } |
| 215 | while( *wUnicode != '\0' ){ |
| 216 | if ( (*wUnicode < ' ') || wcschr(L"\"*:<>?|", *wUnicode) ){ |
| 217 | *wUnicode |= 0xF000; |
| 218 | }else if( *wUnicode == '/' ){ |
| 219 | *wUnicode = '\\'; |
| 220 | } |
| 221 | ++wUnicode; |
| 222 | } |
| 223 | return zUnicode; |
| 224 |
+5
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -1,8 +1,13 @@ | ||
| 1 | 1 | <title>Change Log</title> |
| 2 | 2 | |
| 3 | 3 | <h2>Changes For Version 1.26 (as yet unreleased)</h2> |
| 4 | + * Win32: Fossil now understands Cygwin paths containing one or more of | |
| 5 | + the characters <nowiki>"*:<>?|</nowiki>. Those are normally forbidden in | |
| 6 | + win32. This means that the win32 fossil.exe is better usable in a Cygwin | |
| 7 | + environment. See | |
| 8 | + [http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars]. | |
| 4 | 9 | * Cygwin: Fossil now understands win32 absolute paths starting with a drive |
| 5 | 10 | letter everywhere. The default value of the "case-sensitive" setting is |
| 6 | 11 | now FALSE. |
| 7 | 12 | * Enhancements to /timeline.rss, adding more flags for filtering |
| 8 | 13 | results, including the ability to subscribe to changes made |
| 9 | 14 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,8 +1,13 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes For Version 1.26 (as yet unreleased)</h2> |
| 4 | * Cygwin: Fossil now understands win32 absolute paths starting with a drive |
| 5 | letter everywhere. The default value of the "case-sensitive" setting is |
| 6 | now FALSE. |
| 7 | * Enhancements to /timeline.rss, adding more flags for filtering |
| 8 | results, including the ability to subscribe to changes made |
| 9 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,8 +1,13 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes For Version 1.26 (as yet unreleased)</h2> |
| 4 | * Win32: Fossil now understands Cygwin paths containing one or more of |
| 5 | the characters <nowiki>"*:<>?|</nowiki>. Those are normally forbidden in |
| 6 | win32. This means that the win32 fossil.exe is better usable in a Cygwin |
| 7 | environment. See |
| 8 | [http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars]. |
| 9 | * Cygwin: Fossil now understands win32 absolute paths starting with a drive |
| 10 | letter everywhere. The default value of the "case-sensitive" setting is |
| 11 | now FALSE. |
| 12 | * Enhancements to /timeline.rss, adding more flags for filtering |
| 13 | results, including the ability to subscribe to changes made |
| 14 |
+5
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -1,8 +1,13 @@ | ||
| 1 | 1 | <title>Change Log</title> |
| 2 | 2 | |
| 3 | 3 | <h2>Changes For Version 1.26 (as yet unreleased)</h2> |
| 4 | + * Win32: Fossil now understands Cygwin paths containing one or more of | |
| 5 | + the characters <nowiki>"*:<>?|</nowiki>. Those are normally forbidden in | |
| 6 | + win32. This means that the win32 fossil.exe is better usable in a Cygwin | |
| 7 | + environment. See | |
| 8 | + [http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars]. | |
| 4 | 9 | * Cygwin: Fossil now understands win32 absolute paths starting with a drive |
| 5 | 10 | letter everywhere. The default value of the "case-sensitive" setting is |
| 6 | 11 | now FALSE. |
| 7 | 12 | * Enhancements to /timeline.rss, adding more flags for filtering |
| 8 | 13 | results, including the ability to subscribe to changes made |
| 9 | 14 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,8 +1,13 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes For Version 1.26 (as yet unreleased)</h2> |
| 4 | * Cygwin: Fossil now understands win32 absolute paths starting with a drive |
| 5 | letter everywhere. The default value of the "case-sensitive" setting is |
| 6 | now FALSE. |
| 7 | * Enhancements to /timeline.rss, adding more flags for filtering |
| 8 | results, including the ability to subscribe to changes made |
| 9 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -1,8 +1,13 @@ | |
| 1 | <title>Change Log</title> |
| 2 | |
| 3 | <h2>Changes For Version 1.26 (as yet unreleased)</h2> |
| 4 | * Win32: Fossil now understands Cygwin paths containing one or more of |
| 5 | the characters <nowiki>"*:<>?|</nowiki>. Those are normally forbidden in |
| 6 | win32. This means that the win32 fossil.exe is better usable in a Cygwin |
| 7 | environment. See |
| 8 | [http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars]. |
| 9 | * Cygwin: Fossil now understands win32 absolute paths starting with a drive |
| 10 | letter everywhere. The default value of the "case-sensitive" setting is |
| 11 | now FALSE. |
| 12 | * Enhancements to /timeline.rss, adding more flags for filtering |
| 13 | results, including the ability to subscribe to changes made |
| 14 |