Changeset 4123
- Timestamp:
- 10/30/08 06:38:25 (2 months ago)
- Files:
-
- 2 modified
-
branches/1.0.0_RC/libtorrent/src/storage.cpp (modified) (3 diffs)
-
trunk/libtorrent/src/storage.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0.0_RC/libtorrent/src/storage.cpp
r4018 r4123 506 506 if (dir != last_path) 507 507 { 508 last_path = dir; 508 509 509 510 #if defined(_WIN32) && defined(UNICODE) && BOOST_VERSION < 103400 510 last_path = dir;511 511 if (!exists_win(last_path)) 512 512 create_directories_win(last_path); 513 513 #elif TORRENT_USE_WPATH 514 last_path = dir;515 514 fs::wpath wp = safe_convert(last_path.string()); 516 515 if (!exists(wp)) 517 516 create_directories(wp); 518 517 #else 519 last_path = dir;520 518 if (!exists(last_path)) 521 519 create_directories(last_path); … … 523 521 } 524 522 525 // if the file is empty, just create it. But also make sure526 // the directory exists.527 if (file_iter->size == 0)528 {529 boost::shared_ptr<file> f = m_pool.open_file(this530 , m_save_path / file_iter->path, file::in | file::out, ec);531 if (ec)532 {533 set_error(m_save_path / file_iter->path, ec);534 return true;535 }536 continue;537 }538 539 523 #ifndef BOOST_NO_EXCEPTIONS 540 524 try { 541 525 #endif 542 // don't allocate files with priority 0 543 int file_index = file_iter - files().begin(); 544 if (allocate_files && (int(m_file_priority.size()) <= file_index 545 || m_file_priority[file_index] > 0)) 526 527 #if TORRENT_USE_WPATH 528 fs::wpath file_path = safe_convert(m_save_path / file_iter->path); 529 #else 530 fs::path file_path = m_save_path / file_iter->path; 531 #endif 532 // if the file is empty, just create it either way. 533 // if the file already exists, but is larger than what 534 // it's supposed to be, also truncate it 535 if (allocate_files 536 || file_iter->size == 0 537 || (exists(file_path) && file_size(file_path) > file_iter->size)) 546 538 { 547 539 error_code ec; … … 2281 2273 && m_storage->error() != error_code(ENOENT, get_posix_category())) 2282 2274 #endif 2283 {2284 std::cerr << m_storage->error().message() << std::endl;2285 2275 return -1; 2286 }2287 2276 return 1; 2288 2277 } -
trunk/libtorrent/src/storage.cpp
r4018 r4123 506 506 if (dir != last_path) 507 507 { 508 last_path = dir; 508 509 509 510 #if defined(_WIN32) && defined(UNICODE) && BOOST_VERSION < 103400 510 last_path = dir;511 511 if (!exists_win(last_path)) 512 512 create_directories_win(last_path); 513 513 #elif TORRENT_USE_WPATH 514 last_path = dir;515 514 fs::wpath wp = safe_convert(last_path.string()); 516 515 if (!exists(wp)) 517 516 create_directories(wp); 518 517 #else 519 last_path = dir;520 518 if (!exists(last_path)) 521 519 create_directories(last_path); … … 523 521 } 524 522 525 // if the file is empty, just create it. But also make sure526 // the directory exists.527 if (file_iter->size == 0)528 {529 boost::shared_ptr<file> f = m_pool.open_file(this530 , m_save_path / file_iter->path, file::in | file::out, ec);531 if (ec)532 {533 set_error(m_save_path / file_iter->path, ec);534 return true;535 }536 continue;537 }538 539 523 #ifndef BOOST_NO_EXCEPTIONS 540 524 try { 541 525 #endif 542 // don't allocate files with priority 0 543 int file_index = file_iter - files().begin(); 544 if (allocate_files && (int(m_file_priority.size()) <= file_index 545 || m_file_priority[file_index] > 0)) 526 527 #if TORRENT_USE_WPATH 528 fs::wpath file_path = safe_convert(m_save_path / file_iter->path); 529 #else 530 fs::path file_path = m_save_path / file_iter->path; 531 #endif 532 // if the file is empty, just create it either way. 533 // if the file already exists, but is larger than what 534 // it's supposed to be, also truncate it 535 if (allocate_files 536 || file_iter->size == 0 537 || (exists(file_path) && file_size(file_path) > file_iter->size)) 546 538 { 547 539 error_code ec; … … 2281 2273 && m_storage->error() != error_code(ENOENT, get_posix_category())) 2282 2274 #endif 2283 {2284 std::cerr << m_storage->error().message() << std::endl;2285 2275 return -1; 2286 }2287 2276 return 1; 2288 2277 }
