| | @@ -86,21 +86,21 @@ |
| 86 | 86 | ** lstat() is called on Unix if isWd is TRUE and allow-symlinks setting is on. |
| 87 | 87 | ** |
| 88 | 88 | */ |
| 89 | 89 | static int fossil_stat(const char *zFilename, struct fossilStat *buf, int isWd){ |
| 90 | 90 | int rc; |
| 91 | | - void *zMbcs = fossil_utf8_to_filename(zFilename); |
| 91 | + void *zMbcs = fossil_utf8_to_path(zFilename, 0); |
| 92 | 92 | #if !defined(_WIN32) |
| 93 | 93 | if( isWd && g.allowSymlinks ){ |
| 94 | 94 | rc = lstat(zMbcs, buf); |
| 95 | 95 | }else{ |
| 96 | 96 | rc = stat(zMbcs, buf); |
| 97 | 97 | } |
| 98 | 98 | #else |
| 99 | 99 | rc = win32_stat(zMbcs, buf, isWd); |
| 100 | 100 | #endif |
| 101 | | - fossil_filename_free(zMbcs); |
| 101 | + fossil_path_free(zMbcs); |
| 102 | 102 | return rc; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /* |
| 106 | 106 | ** Fill in the fileStat variable for the file named zFilename. |
| | @@ -314,17 +314,17 @@ |
| 314 | 314 | /* |
| 315 | 315 | ** Wrapper around the access() system call. |
| 316 | 316 | */ |
| 317 | 317 | int file_access(const char *zFilename, int flags){ |
| 318 | 318 | int rc; |
| 319 | | - void *zMbcs = fossil_utf8_to_filename(zFilename); |
| 319 | + void *zMbcs = fossil_utf8_to_path(zFilename, 0); |
| 320 | 320 | #ifdef _WIN32 |
| 321 | 321 | rc = win32_access(zMbcs, flags); |
| 322 | 322 | #else |
| 323 | 323 | rc = access(zMbcs, flags); |
| 324 | 324 | #endif |
| 325 | | - fossil_filename_free(zMbcs); |
| 325 | + fossil_path_free(zMbcs); |
| 326 | 326 | return rc; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /* |
| 330 | 330 | ** Wrapper around the chdir() system call. |
| | @@ -331,21 +331,21 @@ |
| 331 | 331 | ** If bChroot=1, do a chroot to this dir as well |
| 332 | 332 | ** (UNIX only) |
| 333 | 333 | */ |
| 334 | 334 | int file_chdir(const char *zChDir, int bChroot){ |
| 335 | 335 | int rc; |
| 336 | | - void *zPath = fossil_utf8_to_filename(zChDir); |
| 336 | + void *zPath = fossil_utf8_to_path(zChDir, 1); |
| 337 | 337 | #ifdef _WIN32 |
| 338 | 338 | rc = win32_chdir(zPath, bChroot); |
| 339 | 339 | #else |
| 340 | 340 | rc = chdir(zPath); |
| 341 | 341 | if( !rc && bChroot ){ |
| 342 | 342 | rc = chroot(zPath); |
| 343 | 343 | if( !rc ) rc = chdir("/"); |
| 344 | 344 | } |
| 345 | 345 | #endif |
| 346 | | - fossil_filename_free(zPath); |
| 346 | + fossil_path_free(zPath); |
| 347 | 347 | return rc; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /* |
| 351 | 351 | ** Find an unused filename similar to zBase with zSuffix appended. |
| | @@ -469,20 +469,20 @@ |
| 469 | 469 | char *zMbcs; |
| 470 | 470 | struct timeval tv[2]; |
| 471 | 471 | memset(tv, 0, sizeof(tv[0])*2); |
| 472 | 472 | tv[0].tv_sec = newMTime; |
| 473 | 473 | tv[1].tv_sec = newMTime; |
| 474 | | - zMbcs = fossil_utf8_to_filename(zFilename); |
| 474 | + zMbcs = fossil_utf8_to_path(zFilename, 0); |
| 475 | 475 | utimes(zMbcs, tv); |
| 476 | 476 | #else |
| 477 | 477 | struct _utimbuf tb; |
| 478 | | - wchar_t *zMbcs = fossil_utf8_to_filename(zFilename); |
| 478 | + wchar_t *zMbcs = fossil_utf8_to_path(zFilename, 0); |
| 479 | 479 | tb.actime = newMTime; |
| 480 | 480 | tb.modtime = newMTime; |
| 481 | 481 | _wutime(zMbcs, &tb); |
| 482 | 482 | #endif |
| 483 | | - fossil_filename_free(zMbcs); |
| 483 | + fossil_path_free(zMbcs); |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /* |
| 487 | 487 | ** COMMAND: test-set-mtime |
| 488 | 488 | ** |
| | @@ -512,17 +512,17 @@ |
| 512 | 512 | ** Returns zero upon success. |
| 513 | 513 | */ |
| 514 | 514 | int file_delete(const char *zFilename){ |
| 515 | 515 | int rc; |
| 516 | 516 | #ifdef _WIN32 |
| 517 | | - wchar_t *z = fossil_utf8_to_filename(zFilename); |
| 517 | + wchar_t *z = fossil_utf8_to_path(zFilename, 0); |
| 518 | 518 | rc = _wunlink(z); |
| 519 | 519 | #else |
| 520 | | - char *z = fossil_utf8_to_filename(zFilename); |
| 520 | + char *z = fossil_utf8_to_path(zFilename, 0); |
| 521 | 521 | rc = unlink(zFilename); |
| 522 | 522 | #endif |
| 523 | | - fossil_filename_free(z); |
| 523 | + fossil_path_free(z); |
| 524 | 524 | return rc; |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | /* |
| 528 | 528 | ** Create the directory named in the argument, if it does not already |
| | @@ -537,17 +537,17 @@ |
| 537 | 537 | if( !forceFlag ) return 1; |
| 538 | 538 | file_delete(zName); |
| 539 | 539 | } |
| 540 | 540 | if( rc!=1 ){ |
| 541 | 541 | #if defined(_WIN32) |
| 542 | | - wchar_t *zMbcs = fossil_utf8_to_filename(zName); |
| 542 | + wchar_t *zMbcs = fossil_utf8_to_path(zName, 1); |
| 543 | 543 | rc = _wmkdir(zMbcs); |
| 544 | 544 | #else |
| 545 | | - char *zMbcs = fossil_utf8_to_filename(zName); |
| 545 | + char *zMbcs = fossil_utf8_to_path(zName, 1); |
| 546 | 546 | rc = mkdir(zName, 0755); |
| 547 | 547 | #endif |
| 548 | | - fossil_filename_free(zMbcs); |
| 548 | + fossil_path_free(zMbcs); |
| 549 | 549 | return rc; |
| 550 | 550 | } |
| 551 | 551 | return 0; |
| 552 | 552 | } |
| 553 | 553 | |
| | @@ -602,17 +602,17 @@ |
| 602 | 602 | int file_rmdir(const char *zName){ |
| 603 | 603 | int rc = file_wd_isdir(zName); |
| 604 | 604 | if( rc==2 ) return 1; /* cannot remove normal file */ |
| 605 | 605 | if( rc==1 ){ |
| 606 | 606 | #if defined(_WIN32) |
| 607 | | - wchar_t *zMbcs = fossil_utf8_to_filename(zName); |
| 607 | + wchar_t *zMbcs = fossil_utf8_to_path(zName, 1); |
| 608 | 608 | rc = _wrmdir(zMbcs); |
| 609 | 609 | #else |
| 610 | | - char *zMbcs = fossil_utf8_to_filename(zName); |
| 610 | + char *zMbcs = fossil_utf8_to_path(zName, 1); |
| 611 | 611 | rc = rmdir(zName); |
| 612 | 612 | #endif |
| 613 | | - fossil_filename_free(zMbcs); |
| 613 | + fossil_path_free(zMbcs); |
| 614 | 614 | return rc; |
| 615 | 615 | } |
| 616 | 616 | return 0; |
| 617 | 617 | } |
| 618 | 618 | |
| | @@ -1243,11 +1243,11 @@ |
| 1243 | 1243 | |
| 1244 | 1244 | #if defined(_WIN32) |
| 1245 | 1245 | wchar_t zTmpPath[MAX_PATH]; |
| 1246 | 1246 | |
| 1247 | 1247 | if( GetTempPathW(MAX_PATH, zTmpPath) ){ |
| 1248 | | - azDirs[0] = fossil_filename_to_utf8(zTmpPath); |
| 1248 | + azDirs[0] = fossil_path_to_utf8(zTmpPath); |
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | azDirs[1] = fossil_getenv("TEMP"); |
| 1252 | 1252 | azDirs[2] = fossil_getenv("TMP"); |
| 1253 | 1253 | #endif |
| | @@ -1277,13 +1277,13 @@ |
| 1277 | 1277 | } |
| 1278 | 1278 | zBuf[j] = 0; |
| 1279 | 1279 | }while( file_size(zBuf)>=0 ); |
| 1280 | 1280 | |
| 1281 | 1281 | #if defined(_WIN32) |
| 1282 | | - fossil_filename_free((char *)azDirs[0]); |
| 1283 | | - fossil_filename_free((char *)azDirs[1]); |
| 1284 | | - fossil_filename_free((char *)azDirs[2]); |
| 1282 | + fossil_path_free((char *)azDirs[0]); |
| 1283 | + fossil_path_free((char *)azDirs[1]); |
| 1284 | + fossil_path_free((char *)azDirs[2]); |
| 1285 | 1285 | #endif |
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | |
| 1289 | 1289 | /* |
| | @@ -1309,21 +1309,21 @@ |
| 1309 | 1309 | return rc==0; |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | /* |
| 1313 | 1313 | ** Return the value of an environment variable as UTF8. |
| 1314 | | -** Use fossil_filename_free() to release resources. |
| 1314 | +** Use fossil_path_free() to release resources. |
| 1315 | 1315 | */ |
| 1316 | 1316 | char *fossil_getenv(const char *zName){ |
| 1317 | 1317 | #ifdef _WIN32 |
| 1318 | 1318 | wchar_t *uName = fossil_utf8_to_unicode(zName); |
| 1319 | 1319 | void *zValue = _wgetenv(uName); |
| 1320 | 1320 | fossil_unicode_free(uName); |
| 1321 | 1321 | #else |
| 1322 | 1322 | char *zValue = getenv(zName); |
| 1323 | 1323 | #endif |
| 1324 | | - if( zValue ) zValue = fossil_filename_to_utf8(zValue); |
| 1324 | + if( zValue ) zValue = fossil_path_to_utf8(zValue); |
| 1325 | 1325 | return zValue; |
| 1326 | 1326 | } |
| 1327 | 1327 | |
| 1328 | 1328 | /* |
| 1329 | 1329 | ** Sets the value of an environment variable as UTF8. |
| | @@ -1348,14 +1348,14 @@ |
| 1348 | 1348 | ** Like fopen() but always takes a UTF8 argument. |
| 1349 | 1349 | */ |
| 1350 | 1350 | FILE *fossil_fopen(const char *zName, const char *zMode){ |
| 1351 | 1351 | #ifdef _WIN32 |
| 1352 | 1352 | wchar_t *uMode = fossil_utf8_to_unicode(zMode); |
| 1353 | | - wchar_t *uName = fossil_utf8_to_filename(zName); |
| 1353 | + wchar_t *uName = fossil_utf8_to_path(zName, 0); |
| 1354 | 1354 | FILE *f = _wfopen(uName, uMode); |
| 1355 | | - fossil_filename_free(uName); |
| 1355 | + fossil_path_free(uName); |
| 1356 | 1356 | fossil_unicode_free(uMode); |
| 1357 | 1357 | #else |
| 1358 | 1358 | FILE *f = fopen(zName, zMode); |
| 1359 | 1359 | #endif |
| 1360 | 1360 | return f; |
| 1361 | 1361 | } |
| 1362 | 1362 | |