Changeset 4443
- Timestamp:
- 01/27/07 15:28:10 (2 years ago)
- Files:
-
- wired/trunk/NEWS (modified) (1 diff)
- wired/trunk/wired/files.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wired/trunk/NEWS
r4365 r4443 4 4 1.3.2 5 5 - Fix a problem with posting longer news posts 6 - Fix a problem with renaming files when changing case only 6 7 7 8 1.3.1 wired/trunk/wired/files.c
r4426 r4443 433 433 wi_boolean_t wd_files_move_path(wi_string_t *frompath, wi_string_t *topath) { 434 434 wi_array_t *array; 435 wi_string_t *component, *realfrompath, *realtopath; 435 wi_string_t *realfrompath, *realtopath; 436 wi_string_t *realfromname, *realtoname; 437 wi_string_t *path; 436 438 struct stat sb; 437 wi_boolean_t result = false;439 wi_boolean_t result; 438 440 439 441 realfrompath = wd_files_real_path(frompath); 440 442 realtopath = wd_files_real_path(topath); 441 component = wi_string_last_path_component(realfrompath); 443 realfromname = wi_string_last_path_component(realfrompath); 444 realtoname = wi_string_last_path_component(realtopath); 442 445 443 446 wi_string_delete_last_path_component(realfrompath); 444 447 wi_string_resolve_aliases_in_path(realfrompath); 445 448 wi_string_resolve_aliases_in_path(realtopath); 446 wi_string_append_path_component(realfrompath, component);449 wi_string_append_path_component(realfrompath, realfromname); 447 450 448 451 if(!wi_file_lstat(realfrompath, &sb)) { … … 453 456 } 454 457 455 if(wi_file_lstat(realtopath, &sb)) { 456 wd_reply(521, WI_STR("File or Directory Exists")); 457 458 return false; 459 } 460 461 result = wi_file_rename(realfrompath, realtopath); 458 if(wi_string_case_insensitive_compare(realfromname, realtoname) == 0) { 459 path = wi_file_temporary_path_with_prefix_in_directory( 460 wi_string_with_format(WI_STR(".%@"), realfromname), 461 wi_string_by_deleting_last_path_component(realfrompath)); 462 463 result = wi_file_rename(realfrompath, path); 464 465 if(result) 466 result = wi_file_rename(path, realtopath); 467 } else { 468 if(wi_file_lstat(realtopath, &sb)) { 469 wd_reply(521, WI_STR("File or Directory Exists")); 470 471 return false; 472 } 473 474 result = wi_file_rename(realfrompath, realtopath); 475 } 462 476 463 477 if(result) {
