From 062e4d2a8acf01f59efb75a154738ee06fd8d7ee Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Thu, 19 Jun 2008 01:24:19 +0000 Subject: [PATCH] wpath fix --- libtorrent/src/storage.cpp | 108 ++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/libtorrent/src/storage.cpp b/libtorrent/src/storage.cpp index 57d90e5c0..1553c5dd3 100755 --- a/libtorrent/src/storage.cpp +++ b/libtorrent/src/storage.cpp @@ -1,4 +1,4 @@ -/* +a/* Copyright (c) 2003, Arvid Norberg, Daniel Wallin All rights reserved. @@ -252,52 +252,52 @@ namespace namespace libtorrent { - template - void recursive_copy(Path const& old_path, Path const& new_path, std::string& error) - { - using boost::filesystem::directory_iterator; -#ifndef BOOST_NO_EXCEPTIONS - try { -#endif - TORRENT_ASSERT(error.empty()); - if (is_directory(old_path)) - { - create_directory(new_path); - for (directory_iterator i(old_path), end; i != end; ++i) - { - recursive_copy(i->path(), new_path / i->leaf(), error); - if (!error.empty()) return; - } - } - else - { - copy_file(old_path, new_path); - } -#ifndef BOOST_NO_EXCEPTIONS - } catch (std::exception& e) { error = e.what(); } -#endif - } - - template - void recursive_remove(Path const& old_path) - { - using boost::filesystem::directory_iterator; -#ifndef BOOST_NO_EXCEPTIONS - try { -#endif - if (is_directory(old_path)) - { - for (directory_iterator i(old_path), end; i != end; ++i) - recursive_remove(i->path()); - remove(old_path); - } - else - { - remove(old_path); - } -#ifndef BOOST_NO_EXCEPTIONS - } catch (std::exception& e) {} -#endif + template + void recursive_copy(Path const& old_path, Path const& new_path, std::string& error) + { + using boost::filesystem::basic_directory_iterator; +#ifndef BOOST_NO_EXCEPTIONS + try { +#endif + TORRENT_ASSERT(error.empty()); + if (is_directory(old_path)) + { + create_directory(new_path); + for (basic_directory_iterator i(old_path), end; i != end; ++i) + { + recursive_copy(i->path(), new_path / i->leaf(), error); + if (!error.empty()) return; + } + } + else + { + copy_file(old_path, new_path); + } +#ifndef BOOST_NO_EXCEPTIONS + } catch (std::exception& e) { error = e.what(); } +#endif + } + + template + void recursive_remove(Path const& old_path) + { + using boost::filesystem::basic_directory_iterator; +#ifndef BOOST_NO_EXCEPTIONS + try { +#endif + if (is_directory(old_path)) + { + for (basic_directory_iterator i(old_path), end; i != end; ++i) + recursive_remove(i->path()); + remove(old_path); + } + else + { + remove(old_path); + } +#ifndef BOOST_NO_EXCEPTIONS + } catch (std::exception& e) {} +#endif } std::vector > get_filesizes( torrent_info const& t, fs::path p) @@ -716,13 +716,13 @@ namespace libtorrent } catch (std::exception& e) { - std::string err; - recursive_copy(old_path, new_path, err); - if (!err.empty()) - { - return true; - } - m_save_path = save_path; + std::string err; + recursive_copy(old_path, new_path, err); + if (!err.empty()) + { + return true; + } + m_save_path = save_path; recursive_remove(old_path); } }