Changeset 6150
- Timestamp:
- 09/22/08 16:41:12 (4 months ago)
- Files:
-
- branches/P7/wired/wired/files.c (modified) (35 diffs)
- branches/P7/wired/wired/main.c (modified) (2 diffs)
- branches/P7/wired/wired/news.c (modified) (1 diff)
- branches/P7/wired/wired/server.c (modified) (2 diffs)
- branches/P7/wired/wired/server.h (modified) (1 diff)
- branches/P7/wired/wired/transfers.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/P7/wired/wired/files.c
r6141 r6150 183 183 if(!fsenumerator) { 184 184 wi_log_warn(WI_STR("Could not open %@: %m"), realpath); 185 wd_user_reply_ errno(user, message);185 wd_user_reply_file_errno(user, message); 186 186 187 187 return; … … 214 214 wi_string_insert_string_at_index(virtualpath, path, 0); 215 215 216 alias = wi_fs_ is_alias(filepath);216 alias = wi_fs_path_is_alias(filepath); 217 217 218 218 if(alias) … … 221 221 resolvedpath = filepath; 222 222 223 if(!wi_fs_lstat (resolvedpath, &lsb)) {223 if(!wi_fs_lstat_path(resolvedpath, &lsb)) { 224 224 wi_log_warn(WI_STR("Could not list %@: %m"), resolvedpath); 225 225 … … 227 227 } 228 228 229 if(!wi_fs_stat (resolvedpath, &sb))229 if(!wi_fs_stat_path(resolvedpath, &sb)) 230 230 sb = lsb; 231 231 … … 279 279 upload = false; 280 280 281 if(upload && wi_fs_statfs (realpath, &sfb))281 if(upload && wi_fs_statfs_path(realpath, &sfb)) 282 282 available = (wi_file_offset_t) sfb.bavail * (wi_file_offset_t) sfb.frsize; 283 283 else … … 304 304 305 305 if(user) 306 wd_user_reply_ errno(user, message);306 wd_user_reply_file_errno(user, message); 307 307 308 308 return 0; … … 334 334 335 335 realpath = wd_files_real_path(path, user); 336 alias = wi_fs_ is_alias(realpath);336 alias = wi_fs_path_is_alias(realpath); 337 337 338 338 if(alias) 339 339 wi_string_resolve_aliases_in_path(realpath); 340 340 341 if(!wi_fs_lstat (realpath, &lsb)) {341 if(!wi_fs_lstat_path(realpath, &lsb)) { 342 342 wi_log_warn(WI_STR("Could not read info for %@: %m"), realpath); 343 wd_user_reply_ errno(user, message);343 wd_user_reply_file_errno(user, message); 344 344 345 345 return; 346 346 } 347 347 348 if(!wi_fs_stat (realpath, &sb))348 if(!wi_fs_stat_path(realpath, &sb)) 349 349 sb = lsb; 350 350 … … 413 413 if(!wi_fs_create_directory(realpath, 0777)) { 414 414 wi_log_warn(WI_STR("Could not create %@: %m"), realpath); 415 wd_user_reply_ errno(user, message);415 wd_user_reply_file_errno(user, message); 416 416 417 417 return false; … … 437 437 wi_string_append_path_component(realpath, component); 438 438 439 result = wi_fs_delete (realpath);439 result = wi_fs_delete_path(realpath); 440 440 441 441 if(result) { … … 443 443 } else { 444 444 wi_log_warn(WI_STR("Could not delete %@: %m"), realpath); 445 wd_user_reply_ errno(user, message);445 wd_user_reply_file_errno(user, message); 446 446 } 447 447 … … 469 469 wi_string_append_path_component(realtopath, realtoname); 470 470 471 if(!wi_fs_lstat (realfrompath, &sb)) {471 if(!wi_fs_lstat_path(realfrompath, &sb)) { 472 472 wi_log_warn(WI_STR("Could not rename %@: %m"), realfrompath); 473 wd_user_reply_ errno(user, message);473 wd_user_reply_file_errno(user, message); 474 474 475 475 return false; … … 483 483 484 484 if(path) { 485 result = wi_fs_rename (realfrompath, path);485 result = wi_fs_rename_path(realfrompath, path); 486 486 487 487 if(result) 488 result = wi_fs_rename (path, realtopath);488 result = wi_fs_rename_path(path, realtopath); 489 489 } 490 490 } else { 491 if(wi_fs_lstat (realtopath, &sb)) {491 if(wi_fs_lstat_path(realtopath, &sb)) { 492 492 wd_user_reply_error(user, WI_STR("wired.error.file_exists"), message); 493 493 … … 495 495 } 496 496 497 result = wi_fs_rename (realfrompath, realtopath);497 result = wi_fs_rename_path(realfrompath, realtopath); 498 498 } 499 499 … … 520 520 wi_log_warn(WI_STR("Could not rename %@ to %@: %m"), 521 521 realfrompath, realtopath); 522 wd_user_reply_ errno(user, message);522 wd_user_reply_file_errno(user, message); 523 523 } 524 524 } … … 540 540 realtopath = WI_ARRAY(array, 3); 541 541 542 if(wi_fs_copy (realfrompath, realtopath)) {543 if(wi_fs_delete (realfrompath))542 if(wi_fs_copy_path(realfrompath, realtopath)) { 543 if(wi_fs_delete_path(realfrompath)) 544 544 wd_files_move_comment(frompath, topath, NULL, NULL); 545 545 else … … 569 569 wi_string_append_path_component(realfrompath, realfromname); 570 570 571 if(!wi_fs_lstat (realfrompath, &sb)) {571 if(!wi_fs_lstat_path(realfrompath, &sb)) { 572 572 wi_log_warn(WI_STR("Could not link %@: %m"), realfrompath); 573 wd_user_reply_ errno(user, message);573 wd_user_reply_file_errno(user, message); 574 574 575 575 return false; 576 576 } 577 577 578 if(wi_fs_lstat (realtopath, &sb)) {578 if(wi_fs_lstat_path(realtopath, &sb)) { 579 579 wd_user_reply_error(user, WI_STR("wired.error.file_exists"), message); 580 580 … … 582 582 } 583 583 584 if(!wi_fs_symlink (realfrompath, realtopath)) {585 wd_user_reply_ errno(user, message);584 if(!wi_fs_symlink_path(realfrompath, realtopath)) { 585 wd_user_reply_file_errno(user, message); 586 586 587 587 return false; … … 611 611 if(!file) { 612 612 wi_log_warn(WI_STR("Could not open %@: %m"), wd_files_index_path); 613 wd_user_reply_ errno(user, message);613 wd_user_reply_file_errno(user, message); 614 614 615 615 goto end; … … 685 685 686 686 if(!force) { 687 if(wi_fs_stat (wd_files_index_path, &sb)) {687 if(wi_fs_stat_path(wd_files_index_path, &sb)) { 688 688 interval = wi_date_time_interval_since_now(wi_date_with_time(sb.mtime)); 689 689 index_time = (wd_files_index_time > 0.0) ? wd_files_index_time : 3600.0; … … 795 795 wi_rwlock_wrlock(wd_files_index_lock); 796 796 797 if(wi_fs_rename (path, wd_files_index_path)) {797 if(wi_fs_rename_path(path, wd_files_index_path)) { 798 798 wi_log_info(WI_STR("Indexed %u %s and %u %s for a total of %llu %s in %.2f seconds"), 799 799 wd_files_count, … … 875 875 } 876 876 877 alias = wi_fs_ is_alias(filepath);877 alias = wi_fs_path_is_alias(filepath); 878 878 879 879 if(alias) … … 882 882 resolvedpath = filepath; 883 883 884 if(!wi_fs_lstat (resolvedpath, &lsb)) {884 if(!wi_fs_lstat_path(resolvedpath, &lsb)) { 885 885 wi_log_warn(WI_STR("Skipping index of %@: %m"), resolvedpath); 886 886 wi_fsenumerator_skip_descendents(fsenumerator); 887 887 } else { 888 if(!wi_fs_stat (resolvedpath, &sb))888 if(!wi_fs_stat_path(resolvedpath, &sb)) 889 889 sb = lsb; 890 890 … … 1096 1096 wi_fs_stat_t sb; 1097 1097 1098 if(!wi_fs_stat (path, &sb)) {1098 if(!wi_fs_stat_path(path, &sb)) { 1099 1099 wi_log_warn(WI_STR("Could not read type for %@: %m"), path); 1100 1100 … … 1117 1117 typepath = wi_string_by_appending_path_component(realpath, WI_STR(WD_FILES_META_TYPE_PATH)); 1118 1118 1119 if(!wi_fs_stat (typepath, &sb) || sb.size > 8)1119 if(!wi_fs_stat_path(typepath, &sb) || sb.size > 8) 1120 1120 return WD_FILE_TYPE_DIR; 1121 1121 … … 1148 1148 if(wi_error_code() != EEXIST) { 1149 1149 wi_log_warn(WI_STR("Could not create %@: %m"), metapath); 1150 wd_user_reply_ errno(user, message);1150 wd_user_reply_file_errno(user, message); 1151 1151 1152 1152 return; … … 1156 1156 if(!wi_string_write_to_file(wi_string_with_format(WI_STR("%u\n"), type), typepath)) { 1157 1157 wi_log_warn(WI_STR("Could not write to %@: %m"), typepath); 1158 wd_user_reply_ errno(user, message);1158 wd_user_reply_file_errno(user, message); 1159 1159 } 1160 1160 } else { 1161 if(wi_fs_delete (typepath))1161 if(wi_fs_delete_path(typepath)) 1162 1162 (void) rmdir(wi_string_cstring(metapath)); 1163 1163 } … … 1173 1173 realpath = wi_string_by_resolving_aliases_in_path(wd_files_real_path(path, user)); 1174 1174 1175 if(!wi_fs_set_mode (realpath, executable ? 0755 : 0644)) {1175 if(!wi_fs_set_mode_for_path(realpath, executable ? 0755 : 0644)) { 1176 1176 wi_log_warn(WI_STR("Could not set mode for %@: %m"), realpath); 1177 wd_user_reply_ errno(user, message);1177 wd_user_reply_file_errno(user, message); 1178 1178 } 1179 1179 } … … 1193 1193 #ifdef HAVE_CORESERVICES_CORESERVICES_H 1194 1194 realpath = wi_string_by_resolving_aliases_in_path(wd_files_real_path(path, user)); 1195 comment = wi_fs_finder_comment (realpath);1195 comment = wi_fs_finder_comment_for_path(realpath); 1196 1196 1197 1197 if(comment) … … 1239 1239 1240 1240 if(user) 1241 wd_user_reply_ errno(user, message);1241 wd_user_reply_file_errno(user, message); 1242 1242 1243 1243 return; … … 1257 1257 1258 1258 if(user) 1259 wd_user_reply_ errno(user, message);1259 wd_user_reply_file_errno(user, message); 1260 1260 1261 1261 return; … … 1292 1292 wi_file_close(tmpfile); 1293 1293 1294 if(wi_fs_delete (commentpath))1294 if(wi_fs_delete_path(commentpath)) 1295 1295 (void) rmdir(wi_string_cstring(metapath)); 1296 1296 } … … 1299 1299 realpath = wi_string_by_resolving_aliases_in_path(wd_files_real_path(path, user)); 1300 1300 1301 if(wi_fs_ exists(realpath, NULL)) {1302 if(!wi_fs_set_finder_comment (realpath, comment))1303 wi_log_ info(WI_STR("Could not set Finder comment: %m"));1301 if(wi_fs_path_exists(realpath, NULL)) { 1302 if(!wi_fs_set_finder_comment_for_path(realpath, comment)) 1303 wi_log_err(WI_STR("Could not set Finder comment: %m")); 1304 1304 } 1305 1305 #endif … … 1358 1358 permissionspath = wi_string_by_appending_path_component(realpath, WI_STR(WD_FILES_META_PERMISSIONS_PATH)); 1359 1359 1360 if(!wi_fs_stat (permissionspath, &sb) || sb.size > 128)1360 if(!wi_fs_stat_path(permissionspath, &sb) || sb.size > 128) 1361 1361 return false; 1362 1362 … … 1394 1394 if(wi_error_code() != EEXIST) { 1395 1395 wi_log_warn(WI_STR("Could not create %@: %m"), metapath); 1396 wd_user_reply_ errno(user, message);1396 wd_user_reply_file_errno(user, message); 1397 1397 1398 1398 return; … … 1407 1407 if(!wi_string_write_to_file(string, permissionspath)) { 1408 1408 wi_log_warn(WI_STR("Could not write to %@: %m"), permissionspath); 1409 wd_user_reply_ errno(user, message);1409 wd_user_reply_file_errno(user, message); 1410 1410 } 1411 1411 } else { 1412 if(wi_fs_delete (permissionspath))1412 if(wi_fs_delete_path(permissionspath)) 1413 1413 (void) rmdir(wi_string_cstring(metapath)); 1414 1414 } branches/P7/wired/wired/main.c
r6130 r6150 345 345 path = WI_STR("wired.pid"); 346 346 347 if(!wi_fs_delete (path))347 if(!wi_fs_delete_path(path)) 348 348 wi_log_warn(WI_STR("Could not delete %@: %m"), path); 349 349 } … … 396 396 path = WI_STR("wired.status"); 397 397 398 if(!wi_fs_delete (path))398 if(!wi_fs_delete_path(path)) 399 399 wi_log_warn(WI_STR("Could not delete %@: %m"), path); 400 400 } branches/P7/wired/wired/news.c
r6130 r6150 169 169 wi_rwlock_wrlock(wd_news_lock); 170 170 171 if(!wi_fs_clear (wd_news_path))171 if(!wi_fs_clear_path(wd_news_path)) 172 172 wi_log_err(WI_STR("Could not clear %@: %m"), wd_news_path); 173 173 branches/P7/wired/wired/server.c
r6122 r6150 544 544 545 545 546 void wd_user_reply_ errno(wd_user_t *user, wi_p7_message_t *message) {546 void wd_user_reply_file_errno(wd_user_t *user, wi_p7_message_t *message) { 547 547 wi_p7_message_t *reply; 548 548 int code; … … 556 556 wd_user_reply_error(user, WI_STR("wired.error.file_exists"), message); 557 557 } else { 558 reply = wi_p7_message_with_name(WI_STR("wired.error"), wd_p7_spec); 559 wi_p7_message_set_enum_name_for_name(reply, WI_STR("wired.error.internal_error"), WI_STR("wired.error")); 560 wi_p7_message_set_string_for_name(reply, wi_error_string(), WI_STR("wired.error.string")); 561 wd_user_reply_message(user, reply, message); 562 } 558 wd_user_reply_internal_error(user, message); 559 } 560 } 561 562 563 564 void wd_user_reply_internal_error(wd_user_t *user, wi_p7_message_t *message) { 565 wi_p7_message_t *reply; 566 567 reply = wi_p7_message_with_name(WI_STR("wired.error"), wd_p7_spec); 568 wi_p7_message_set_enum_name_for_name(reply, WI_STR("wired.error.internal_error"), WI_STR("wired.error")); 569 wi_p7_message_set_string_for_name(reply, wi_error_string(), WI_STR("wired.error.string")); 570 wd_user_reply_message(user, reply, message); 563 571 } 564 572 branches/P7/wired/wired/server.h
r5627 r6150 49 49 void wd_user_reply_message(wd_user_t *, wi_p7_message_t *, wi_p7_message_t *); 50 50 void wd_user_reply_error(wd_user_t *, wi_string_t *, wi_p7_message_t *); 51 void wd_user_reply_errno(wd_user_t *, wi_p7_message_t *); 51 void wd_user_reply_file_errno(wd_user_t *, wi_p7_message_t *); 52 void wd_user_reply_internal_error(wd_user_t *, wi_p7_message_t *); 52 53 void wd_broadcast_message(wi_p7_message_t *); 53 54 void wd_chat_broadcast_message(wd_chat_t *chat, wi_p7_message_t *); branches/P7/wired/wired/transfers.c
r6130 r6150 217 217 realpath = wi_string_by_resolving_aliases_in_path(wd_files_real_path(path, user)); 218 218 219 if(!wi_fs_stat (realpath, &sb)) {219 if(!wi_fs_stat_path(realpath, &sb)) { 220 220 wi_log_err(WI_STR("Could not open %@: %m"), realpath); 221 wd_user_reply_ errno(user, message);221 wd_user_reply_file_errno(user, message); 222 222 223 223 return; … … 264 264 realpath = wi_string_by_resolving_aliases_in_path(wd_files_real_path(path, user)); 265 265 266 if(wi_fs_stat (realpath, &sb)) {267 wd_user_reply_ errno(user, message);266 if(wi_fs_stat_path(realpath, &sb)) { 267 wd_user_reply_file_errno(user, message); 268 268 269 269 return; … … 273 273 wi_string_append_string(realpath, WI_STR(WD_TRANSFERS_PARTIAL_EXTENSION)); 274 274 275 if(wi_fs_stat (realpath, &sb))275 if(wi_fs_stat_path(realpath, &sb)) 276 276 offset = sb.size; 277 277 else … … 1017 1017 path = wi_string_by_deleting_path_extension(transfer->realpath); 1018 1018 1019 if(wi_fs_rename (transfer->realpath, path)) {1019 if(wi_fs_rename_path(transfer->realpath, path)) { 1020 1020 if(transfer->executable) { 1021 if(!wi_fs_set_mode (path, 0755)) {1021 if(!wi_fs_set_mode_for_path(path, 0755)) { 1022 1022 wi_log_warn(WI_STR("Could not set mode for %@: %m"), 1023 1023 path);
