make flags to move_storage a proper enum class (#2043)
This commit is contained in:
parent
c5cdd381da
commit
5344761da4
|
@ -441,11 +441,11 @@ void bind_torrent_handle()
|
||||||
int (torrent_handle::*piece_priority0)(piece_index_t) const = &torrent_handle::piece_priority;
|
int (torrent_handle::*piece_priority0)(piece_index_t) const = &torrent_handle::piece_priority;
|
||||||
void (torrent_handle::*piece_priority1)(piece_index_t, int) const = &torrent_handle::piece_priority;
|
void (torrent_handle::*piece_priority1)(piece_index_t, int) const = &torrent_handle::piece_priority;
|
||||||
|
|
||||||
void (torrent_handle::*move_storage0)(std::string const&, int flags) const = &torrent_handle::move_storage;
|
void (torrent_handle::*move_storage0)(std::string const&, lt::move_flags_t) const = &torrent_handle::move_storage;
|
||||||
void (torrent_handle::*rename_file0)(file_index_t, std::string const&) const = &torrent_handle::rename_file;
|
void (torrent_handle::*rename_file0)(file_index_t, std::string const&) const = &torrent_handle::rename_file;
|
||||||
|
|
||||||
#if TORRENT_USE_WSTRING && !defined TORRENT_NO_DEPRECATE
|
#if TORRENT_USE_WSTRING && !defined TORRENT_NO_DEPRECATE
|
||||||
void (torrent_handle::*move_storage1)(std::wstring const&, int flags) const = &torrent_handle::move_storage;
|
void (torrent_handle::*move_storage1)(std::wstring const&, int) const = &torrent_handle::move_storage;
|
||||||
void (torrent_handle::*rename_file1)(file_index_t, std::wstring const&) const = &torrent_handle::rename_file;
|
void (torrent_handle::*rename_file1)(file_index_t, std::wstring const&) const = &torrent_handle::rename_file;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -453,6 +453,12 @@ void bind_torrent_handle()
|
||||||
|
|
||||||
#define _ allow_threads
|
#define _ allow_threads
|
||||||
|
|
||||||
|
enum_<move_flags_t>("move_flags_t")
|
||||||
|
.value("always_replace_files", move_flags_t::always_replace_files)
|
||||||
|
.value("fail_if_exist", move_flags_t::fail_if_exist)
|
||||||
|
.value("dont_replace", move_flags_t::dont_replace)
|
||||||
|
;
|
||||||
|
|
||||||
class_<torrent_handle>("torrent_handle")
|
class_<torrent_handle>("torrent_handle")
|
||||||
.def(self == self)
|
.def(self == self)
|
||||||
.def(self != self)
|
.def(self != self)
|
||||||
|
@ -548,13 +554,13 @@ void bind_torrent_handle()
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
.def("set_tracker_login", &torrent_handle::set_tracker_login)
|
.def("set_tracker_login", &torrent_handle::set_tracker_login)
|
||||||
#endif
|
#endif
|
||||||
.def("move_storage", _(move_storage0), (arg("path"), arg("flags") = 0))
|
.def("move_storage", _(move_storage0), (arg("path"), arg("flags") = move_flags_t::always_replace_files))
|
||||||
.def("info_hash", _(&torrent_handle::info_hash))
|
.def("info_hash", _(&torrent_handle::info_hash))
|
||||||
.def("force_recheck", _(&torrent_handle::force_recheck))
|
.def("force_recheck", _(&torrent_handle::force_recheck))
|
||||||
.def("rename_file", _(rename_file0))
|
.def("rename_file", _(rename_file0))
|
||||||
.def("set_ssl_certificate", &torrent_handle::set_ssl_certificate, (arg("cert"), arg("private_key"), arg("dh_params"), arg("passphrase")=""))
|
.def("set_ssl_certificate", &torrent_handle::set_ssl_certificate, (arg("cert"), arg("private_key"), arg("dh_params"), arg("passphrase")=""))
|
||||||
#if TORRENT_USE_WSTRING && !defined TORRENT_NO_DEPRECATE
|
#if TORRENT_USE_WSTRING && !defined TORRENT_NO_DEPRECATE
|
||||||
.def("move_storage", _(move_storage1), (arg("path"), arg("flags") = 0))
|
.def("move_storage", _(move_storage1), (arg("path"), arg("flags") = always_replace_files))
|
||||||
.def("rename_file", _(rename_file1))
|
.def("rename_file", _(rename_file1))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
@ -605,11 +611,6 @@ void bind_torrent_handle()
|
||||||
.value("query_verified_pieces", torrent_handle::query_verified_pieces)
|
.value("query_verified_pieces", torrent_handle::query_verified_pieces)
|
||||||
;
|
;
|
||||||
|
|
||||||
enum_<move_flags_t>("move_flags_t")
|
|
||||||
.value("always_replace_files", always_replace_files)
|
|
||||||
.value("fail_if_exist", fail_if_exist)
|
|
||||||
.value("dont_replace", dont_replace)
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace libtorrent {
|
||||||
, std::string const& save_path
|
, std::string const& save_path
|
||||||
, std::string const& destination_save_path
|
, std::string const& destination_save_path
|
||||||
, part_file* pf
|
, part_file* pf
|
||||||
, int const flags, storage_error& ec);
|
, move_flags_t flags, storage_error& ec);
|
||||||
|
|
||||||
// deletes the files on fs from save_path according to options. Options may
|
// deletes the files on fs from save_path according to options. Options may
|
||||||
// opt to only delete the partfile
|
// opt to only delete the partfile
|
||||||
|
|
|
@ -145,7 +145,7 @@ namespace libtorrent {
|
||||||
, std::uint8_t flags = 0) = 0;
|
, std::uint8_t flags = 0) = 0;
|
||||||
virtual void async_hash(storage_index_t storage, piece_index_t piece, std::uint8_t flags
|
virtual void async_hash(storage_index_t storage, piece_index_t piece, std::uint8_t flags
|
||||||
, std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler, void* requester) = 0;
|
, std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler, void* requester) = 0;
|
||||||
virtual void async_move_storage(storage_index_t storage, std::string p, std::uint8_t flags
|
virtual void async_move_storage(storage_index_t storage, std::string p, move_flags_t flags
|
||||||
, std::function<void(status_t, std::string const&, storage_error const&)> handler) = 0;
|
, std::function<void(status_t, std::string const&, storage_error const&)> handler) = 0;
|
||||||
virtual void async_release_files(storage_index_t storage
|
virtual void async_release_files(storage_index_t storage
|
||||||
, std::function<void()> handler = std::function<void()>()) = 0;
|
, std::function<void()> handler = std::function<void()>()) = 0;
|
||||||
|
|
|
@ -204,6 +204,8 @@ namespace libtorrent {
|
||||||
// flags controlling this job
|
// flags controlling this job
|
||||||
std::uint8_t flags = 0;
|
std::uint8_t flags = 0;
|
||||||
|
|
||||||
|
move_flags_t move_flags = move_flags_t::always_replace_files;
|
||||||
|
|
||||||
#if TORRENT_USE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
bool in_use = false;
|
bool in_use = false;
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ namespace aux {
|
||||||
, std::uint8_t flags = 0) override;
|
, std::uint8_t flags = 0) override;
|
||||||
void async_hash(storage_index_t storage, piece_index_t piece, std::uint8_t flags
|
void async_hash(storage_index_t storage, piece_index_t piece, std::uint8_t flags
|
||||||
, std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler, void* requester) override;
|
, std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler, void* requester) override;
|
||||||
void async_move_storage(storage_index_t storage, std::string p, std::uint8_t flags
|
void async_move_storage(storage_index_t storage, std::string p, move_flags_t flags
|
||||||
, std::function<void(status_t, std::string const&, storage_error const&)> handler) override;
|
, std::function<void(status_t, std::string const&, storage_error const&)> handler) override;
|
||||||
void async_release_files(storage_index_t storage
|
void async_release_files(storage_index_t storage
|
||||||
, std::function<void()> handler = std::function<void()>()) override;
|
, std::function<void()> handler = std::function<void()>()) override;
|
||||||
|
|
|
@ -234,8 +234,8 @@ namespace libtorrent {
|
||||||
// like ``release_files()``.
|
// like ``release_files()``.
|
||||||
//
|
//
|
||||||
//If an error occurs, ``storage_error`` should be set to reflect it.
|
//If an error occurs, ``storage_error`` should be set to reflect it.
|
||||||
virtual status_t move_storage(std::string const& save_path, int flags
|
virtual status_t move_storage(std::string const& save_path
|
||||||
, storage_error& ec) = 0;
|
, move_flags_t flags, storage_error& ec) = 0;
|
||||||
|
|
||||||
// This function should verify the resume data ``rd`` with the files
|
// This function should verify the resume data ``rd`` with the files
|
||||||
// on disk. If the resume data seems to be up-to-date, return true. If
|
// on disk. If the resume data seems to be up-to-date, return true. If
|
||||||
|
@ -390,8 +390,8 @@ namespace libtorrent {
|
||||||
virtual void release_files(storage_error& ec) override;
|
virtual void release_files(storage_error& ec) override;
|
||||||
virtual void delete_files(int options, storage_error& ec) override;
|
virtual void delete_files(int options, storage_error& ec) override;
|
||||||
virtual void initialize(storage_error& ec) override;
|
virtual void initialize(storage_error& ec) override;
|
||||||
virtual status_t move_storage(std::string const& save_path, int flags
|
virtual status_t move_storage(std::string const& save_path
|
||||||
, storage_error& ec) override;
|
, move_flags_t flags, storage_error& ec) override;
|
||||||
virtual bool verify_resume_data(add_torrent_params const& rd
|
virtual bool verify_resume_data(add_torrent_params const& rd
|
||||||
, aux::vector<std::string, file_index_t> const& links
|
, aux::vector<std::string, file_index_t> const& links
|
||||||
, storage_error& error) override;
|
, storage_error& error) override;
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace libtorrent {
|
||||||
};
|
};
|
||||||
|
|
||||||
// flags for async_move_storage
|
// flags for async_move_storage
|
||||||
enum move_flags_t
|
enum class move_flags_t : std::uint8_t
|
||||||
{
|
{
|
||||||
// replace any files in the destination when copying
|
// replace any files in the destination when copying
|
||||||
// or moving the storage
|
// or moving the storage
|
||||||
|
@ -92,6 +92,16 @@ namespace libtorrent {
|
||||||
dont_replace
|
dont_replace
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
// deprecated in 1.2
|
||||||
|
enum deprecated_move_flags_t
|
||||||
|
{
|
||||||
|
always_replace_files TORRENT_DEPRECATED_ENUM,
|
||||||
|
fail_if_exist TORRENT_DEPRECATED_ENUM,
|
||||||
|
dont_replace TORRENT_DEPRECATED_ENUM
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct TORRENT_EXPORT storage_params
|
struct TORRENT_EXPORT storage_params
|
||||||
{
|
{
|
||||||
file_storage const* files = nullptr;
|
file_storage const* files = nullptr;
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ namespace libtorrent {
|
||||||
// RESOURCE MANAGEMENT
|
// RESOURCE MANAGEMENT
|
||||||
|
|
||||||
// flags are defined in storage.hpp
|
// flags are defined in storage.hpp
|
||||||
void move_storage(std::string const& save_path, int flags);
|
void move_storage(std::string const& save_path, move_flags_t flags);
|
||||||
|
|
||||||
// renames the file with the given index to the new name
|
// renames the file with the given index to the new name
|
||||||
// the name may include a directory path
|
// the name may include a directory path
|
||||||
|
|
|
@ -53,6 +53,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/sha1_hash.hpp"
|
#include "libtorrent/sha1_hash.hpp"
|
||||||
#include "libtorrent/units.hpp"
|
#include "libtorrent/units.hpp"
|
||||||
#include "libtorrent/aux_/vector.hpp"
|
#include "libtorrent/aux_/vector.hpp"
|
||||||
|
#include "libtorrent/storage_defs.hpp"
|
||||||
|
|
||||||
namespace libtorrent { namespace aux {
|
namespace libtorrent { namespace aux {
|
||||||
|
|
||||||
|
@ -1211,10 +1212,6 @@ namespace libtorrent { namespace aux {
|
||||||
// The ``flags`` argument determines the behavior of the copying/moving
|
// The ``flags`` argument determines the behavior of the copying/moving
|
||||||
// of the files in the torrent. see move_flags_t.
|
// of the files in the torrent. see move_flags_t.
|
||||||
//
|
//
|
||||||
// * always_replace_files = 0
|
|
||||||
// * fail_if_exist = 1
|
|
||||||
// * dont_replace = 2
|
|
||||||
//
|
|
||||||
// ``always_replace_files`` is the default and replaces any file that
|
// ``always_replace_files`` is the default and replaces any file that
|
||||||
// exist in both the source directory and the target directory.
|
// exist in both the source directory and the target directory.
|
||||||
//
|
//
|
||||||
|
@ -1241,7 +1238,18 @@ namespace libtorrent { namespace aux {
|
||||||
// torrent but are stored in the torrent's directory may be moved as
|
// torrent but are stored in the torrent's directory may be moved as
|
||||||
// well. This goes for files that have been renamed to absolute paths
|
// well. This goes for files that have been renamed to absolute paths
|
||||||
// that still end up inside the save path.
|
// that still end up inside the save path.
|
||||||
|
void move_storage(std::string const& save_path
|
||||||
|
, move_flags_t flags
|
||||||
|
#ifdef TORRENT_NO_DEPRECATE
|
||||||
|
= move_flags_t::always_replace_files
|
||||||
|
#endif
|
||||||
|
) const;
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
// deprecated in 1.2
|
||||||
|
TORRENT_DEPRECATED
|
||||||
void move_storage(std::string const& save_path, int flags = 0) const;
|
void move_storage(std::string const& save_path, int flags = 0) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Renames the file with the given index asynchronously. The rename
|
// Renames the file with the given index asynchronously. The rename
|
||||||
// operation is complete when either a file_renamed_alert or
|
// operation is complete when either a file_renamed_alert or
|
||||||
|
|
|
@ -1805,14 +1805,14 @@ namespace libtorrent {
|
||||||
}
|
}
|
||||||
|
|
||||||
void disk_io_thread::async_move_storage(storage_index_t const storage
|
void disk_io_thread::async_move_storage(storage_index_t const storage
|
||||||
, std::string p, std::uint8_t const flags
|
, std::string p, move_flags_t const flags
|
||||||
, std::function<void(status_t, std::string const&, storage_error const&)> handler)
|
, std::function<void(status_t, std::string const&, storage_error const&)> handler)
|
||||||
{
|
{
|
||||||
disk_io_job* j = allocate_job(disk_io_job::move_storage);
|
disk_io_job* j = allocate_job(disk_io_job::move_storage);
|
||||||
j->storage = m_torrents[storage]->shared_from_this();
|
j->storage = m_torrents[storage]->shared_from_this();
|
||||||
j->argument = std::move(p);
|
j->argument = std::move(p);
|
||||||
j->callback = std::move(handler);
|
j->callback = std::move(handler);
|
||||||
j->flags = flags;
|
j->move_flags = flags;
|
||||||
|
|
||||||
add_fence_job(j);
|
add_fence_job(j);
|
||||||
}
|
}
|
||||||
|
@ -2447,7 +2447,7 @@ namespace libtorrent {
|
||||||
|
|
||||||
// if files have to be closed, that's the storage's responsibility
|
// if files have to be closed, that's the storage's responsibility
|
||||||
return j->storage->move_storage(boost::get<std::string>(j->argument)
|
return j->storage->move_storage(boost::get<std::string>(j->argument)
|
||||||
, j->flags, j->error);
|
, j->move_flags, j->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t disk_io_thread::do_release_files(disk_io_job* j, jobqueue_t& completed_jobs)
|
status_t disk_io_thread::do_release_files(disk_io_job* j, jobqueue_t& completed_jobs)
|
||||||
|
|
|
@ -450,8 +450,8 @@ namespace libtorrent {
|
||||||
, m_file_priority, m_stat_cache, m_save_path, ec);
|
, m_file_priority, m_stat_cache, m_save_path, ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t default_storage::move_storage(std::string const& sp, int const flags
|
status_t default_storage::move_storage(std::string const& sp
|
||||||
, storage_error& ec)
|
, move_flags_t const flags, storage_error& ec)
|
||||||
{
|
{
|
||||||
m_pool.release(storage_index());
|
m_pool.release(storage_index());
|
||||||
|
|
||||||
|
@ -737,7 +737,7 @@ namespace {
|
||||||
void release_files(storage_error&) override {}
|
void release_files(storage_error&) override {}
|
||||||
void delete_files(int, storage_error&) override {}
|
void delete_files(int, storage_error&) override {}
|
||||||
void initialize(storage_error&) override {}
|
void initialize(storage_error&) override {}
|
||||||
status_t move_storage(std::string const&, int, storage_error&) override { return status_t::no_error; }
|
status_t move_storage(std::string const&, move_flags_t, storage_error&) override { return status_t::no_error; }
|
||||||
|
|
||||||
int readv(span<iovec_t const> bufs
|
int readv(span<iovec_t const> bufs
|
||||||
, piece_index_t, int, open_mode_t, storage_error&) override
|
, piece_index_t, int, open_mode_t, storage_error&) override
|
||||||
|
@ -796,7 +796,7 @@ namespace {
|
||||||
void set_file_priority(aux::vector<std::uint8_t, file_index_t> const& /* prio */
|
void set_file_priority(aux::vector<std::uint8_t, file_index_t> const& /* prio */
|
||||||
, storage_error&) override {}
|
, storage_error&) override {}
|
||||||
status_t move_storage(std::string const& /* save_path */
|
status_t move_storage(std::string const& /* save_path */
|
||||||
, int /* flags */, storage_error&) override { return status_t::no_error; }
|
, move_flags_t, storage_error&) override { return status_t::no_error; }
|
||||||
bool verify_resume_data(add_torrent_params const& /* rd */
|
bool verify_resume_data(add_torrent_params const& /* rd */
|
||||||
, aux::vector<std::string, file_index_t> const& /* links */
|
, aux::vector<std::string, file_index_t> const& /* links */
|
||||||
, storage_error&) override
|
, storage_error&) override
|
||||||
|
|
|
@ -199,13 +199,13 @@ namespace libtorrent { namespace aux {
|
||||||
, std::string const& save_path
|
, std::string const& save_path
|
||||||
, std::string const& destination_save_path
|
, std::string const& destination_save_path
|
||||||
, part_file* pf
|
, part_file* pf
|
||||||
, int const flags, storage_error& ec)
|
, move_flags_t const flags, storage_error& ec)
|
||||||
{
|
{
|
||||||
status_t ret = status_t::no_error;
|
status_t ret = status_t::no_error;
|
||||||
std::string const new_save_path = complete(destination_save_path);
|
std::string const new_save_path = complete(destination_save_path);
|
||||||
|
|
||||||
// check to see if any of the files exist
|
// check to see if any of the files exist
|
||||||
if (flags == fail_if_exist)
|
if (flags == move_flags_t::fail_if_exist)
|
||||||
{
|
{
|
||||||
file_status s;
|
file_status s;
|
||||||
error_code err;
|
error_code err;
|
||||||
|
@ -269,7 +269,7 @@ namespace libtorrent { namespace aux {
|
||||||
std::string const old_path = combine_path(save_path, f.file_path(i));
|
std::string const old_path = combine_path(save_path, f.file_path(i));
|
||||||
std::string const new_path = combine_path(new_save_path, f.file_path(i));
|
std::string const new_path = combine_path(new_save_path, f.file_path(i));
|
||||||
|
|
||||||
if (flags == dont_replace && exists(new_path))
|
if (flags == move_flags_t::dont_replace && exists(new_path))
|
||||||
{
|
{
|
||||||
if (ret == status_t::no_error) ret = status_t::need_full_check;
|
if (ret == status_t::no_error) ret = status_t::need_full_check;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -7520,7 +7520,7 @@ namespace libtorrent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::move_storage(std::string const& save_path, int const flags)
|
void torrent::move_storage(std::string const& save_path, move_flags_t const flags)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
@ -7551,7 +7551,7 @@ namespace libtorrent {
|
||||||
#else
|
#else
|
||||||
std::string path = save_path;
|
std::string path = save_path;
|
||||||
#endif
|
#endif
|
||||||
m_ses.disk_thread().async_move_storage(m_storage, std::move(path), std::uint8_t(flags)
|
m_ses.disk_thread().async_move_storage(m_storage, std::move(path), flags
|
||||||
, std::bind(&torrent::on_storage_moved, shared_from_this(), _1, _2, _3));
|
, std::bind(&torrent::on_storage_moved, shared_from_this(), _1, _2, _3));
|
||||||
m_moving_storage = true;
|
m_moving_storage = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,18 +212,25 @@ namespace libtorrent {
|
||||||
return sync_call_ret<int>(0, &torrent::download_limit);
|
return sync_call_ret<int>(0, &torrent::download_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent_handle::move_storage(
|
void torrent_handle::move_storage(std::string const& save_path, move_flags_t flags) const
|
||||||
std::string const& save_path, int flags) const
|
|
||||||
{
|
{
|
||||||
async_call(&torrent::move_storage, save_path, flags);
|
async_call(&torrent::move_storage, save_path, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
void torrent_handle::move_storage(
|
||||||
|
std::string const& save_path, int const flags) const
|
||||||
|
{
|
||||||
|
async_call(&torrent::move_storage, save_path, static_cast<move_flags_t>(flags));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if TORRENT_USE_WSTRING
|
#if TORRENT_USE_WSTRING
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
void torrent_handle::move_storage(
|
void torrent_handle::move_storage(
|
||||||
std::wstring const& save_path, int flags) const
|
std::wstring const& save_path, int flags) const
|
||||||
{
|
{
|
||||||
async_call(&torrent::move_storage, wchar_utf8(save_path), flags);
|
async_call(&torrent::move_storage, wchar_utf8(save_path), static_cast<move_flags_t>(flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent_handle::rename_file(file_index_t index, std::wstring const& new_name) const
|
void torrent_handle::rename_file(file_index_t index, std::wstring const& new_name) const
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct test_storage_impl : storage_interface
|
||||||
bool has_any_file(storage_error& ec) override { return false; }
|
bool has_any_file(storage_error& ec) override { return false; }
|
||||||
void set_file_priority(aux::vector<std::uint8_t, file_index_t> const& prio
|
void set_file_priority(aux::vector<std::uint8_t, file_index_t> const& prio
|
||||||
, storage_error& ec) override {}
|
, storage_error& ec) override {}
|
||||||
status_t move_storage(std::string const& save_path, int flags
|
status_t move_storage(std::string const& save_path, move_flags_t flags
|
||||||
, storage_error& ec) override { return status_t::no_error; }
|
, storage_error& ec) override { return status_t::no_error; }
|
||||||
bool verify_resume_data(add_torrent_params const& rd
|
bool verify_resume_data(add_torrent_params const& rd
|
||||||
, aux::vector<std::string, file_index_t> const& links
|
, aux::vector<std::string, file_index_t> const& links
|
||||||
|
|
|
@ -1367,7 +1367,7 @@ TORRENT_TEST(move_storage_to_self)
|
||||||
TEST_CHECK(exists(combine_path(test_path, combine_path("folder2", "test3.tmp"))));
|
TEST_CHECK(exists(combine_path(test_path, combine_path("folder2", "test3.tmp"))));
|
||||||
TEST_CHECK(exists(combine_path(test_path, combine_path("_folder3", "test4.tmp"))));
|
TEST_CHECK(exists(combine_path(test_path, combine_path("_folder3", "test4.tmp"))));
|
||||||
|
|
||||||
s->move_storage(save_path, 0, se);
|
s->move_storage(save_path, move_flags_t::always_replace_files, se);
|
||||||
TEST_EQUAL(se.ec, boost::system::errc::success);
|
TEST_EQUAL(se.ec, boost::system::errc::success);
|
||||||
|
|
||||||
TEST_CHECK(exists(test_path));
|
TEST_CHECK(exists(test_path));
|
||||||
|
@ -1394,7 +1394,7 @@ TORRENT_TEST(move_storage_into_self)
|
||||||
s->writev(b, piece_index_t(2), 0, open_mode_t::read_write, se);
|
s->writev(b, piece_index_t(2), 0, open_mode_t::read_write, se);
|
||||||
|
|
||||||
std::string const test_path = combine_path(save_path, combine_path("temp_storage", "folder1"));
|
std::string const test_path = combine_path(save_path, combine_path("temp_storage", "folder1"));
|
||||||
s->move_storage(test_path, 0, se);
|
s->move_storage(test_path, move_flags_t::always_replace_files, se);
|
||||||
TEST_EQUAL(se.ec, boost::system::errc::success);
|
TEST_EQUAL(se.ec, boost::system::errc::success);
|
||||||
|
|
||||||
TEST_CHECK(exists(combine_path(test_path, combine_path("temp_storage"
|
TEST_CHECK(exists(combine_path(test_path, combine_path("temp_storage"
|
||||||
|
@ -1453,7 +1453,7 @@ TORRENT_TEST(dont_move_intermingled_files)
|
||||||
f.close();
|
f.close();
|
||||||
TEST_EQUAL(ec, boost::system::errc::success);
|
TEST_EQUAL(ec, boost::system::errc::success);
|
||||||
|
|
||||||
s->move_storage(test_path, 0, se);
|
s->move_storage(test_path, move_flags_t::always_replace_files, se);
|
||||||
TEST_EQUAL(se.ec, boost::system::errc::success);
|
TEST_EQUAL(se.ec, boost::system::errc::success);
|
||||||
|
|
||||||
// torrent files moved to new place
|
// torrent files moved to new place
|
||||||
|
|
Loading…
Reference in New Issue