forked from premiere/premiere-libtorrent
fixed stat_file issue on windows
This commit is contained in:
parent
fccd38d355
commit
4070c2d465
|
@ -109,7 +109,7 @@ namespace libtorrent
|
||||||
};
|
};
|
||||||
|
|
||||||
enum stat_flags_t { dont_follow_links = 1 };
|
enum stat_flags_t { dont_follow_links = 1 };
|
||||||
TORRENT_EXPORT void stat_file(std::string const& f, file_status* s
|
TORRENT_EXPORT void stat_file(std::string f, file_status* s
|
||||||
, error_code& ec, int flags = 0);
|
, error_code& ec, int flags = 0);
|
||||||
TORRENT_EXPORT void rename(std::string const& f
|
TORRENT_EXPORT void rename(std::string const& f
|
||||||
, std::string const& newf, error_code& ec);
|
, std::string const& newf, error_code& ec);
|
||||||
|
|
|
@ -135,10 +135,17 @@ BOOST_STATIC_ASSERT((libtorrent::file::no_buffer & libtorrent::file::attribute_m
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
void stat_file(std::string const& inf, file_status* s
|
void stat_file(std::string inf, file_status* s
|
||||||
, error_code& ec, int flags)
|
, error_code& ec, int flags)
|
||||||
{
|
{
|
||||||
ec.clear();
|
ec.clear();
|
||||||
|
#ifdef TORRENT_WINDOWS
|
||||||
|
// apparently windows doesn't expect paths
|
||||||
|
// to directories to ever end with a \ or /
|
||||||
|
if (!inf.empty() && (inf[inf.size() - 1] == '\\'
|
||||||
|
|| inf[inf.size() - 1] == '/'))
|
||||||
|
inf.resize(inf.size() - 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if TORRENT_USE_WSTRING && defined TORRENT_WINDOWS
|
#if TORRENT_USE_WSTRING && defined TORRENT_WINDOWS
|
||||||
std::wstring f = convert_to_wstring(inf);
|
std::wstring f = convert_to_wstring(inf);
|
||||||
|
|
Loading…
Reference in New Issue