From 59123c793b0c8f6504f3b2e3d41ea63827f9b2b3 Mon Sep 17 00:00:00 2001 From: Arvid Norberg <arvid@libtorrent.org> Date: Sun, 18 Jul 2004 11:40:22 +0000 Subject: [PATCH] *** empty log message *** --- src/storage.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/storage.cpp b/src/storage.cpp index 28524332a..e405b28a0 100755 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -220,9 +220,15 @@ namespace libtorrent std::string old_path; std::string new_path; + fs::create_directory(save_path); + if (m_pimpl->info.num_files() == 1) { - old_path = (m_pimpl->save_path / m_pimpl->info.begin_files()->path) + fs::path single_file = m_pimpl->info.begin_files()->path; + if (single_file.has_branch_path()) + fs::create_directory(save_path / single_file.branch_path()); + + old_path = (m_pimpl->save_path / single_file) .native_file_string(); new_path = (save_path / m_pimpl->info.begin_files()->path) .native_file_string(); @@ -236,7 +242,6 @@ namespace libtorrent .native_directory_string(); } - fs::create_directory(save_path); int ret = std::rename(old_path.c_str(), new_path.c_str()); if (ret == 0) {