fixed stat_file issue on windows

This commit is contained in:
Arvid Norberg 2011-01-25 08:21:01 +00:00
parent fccd38d355
commit 4070c2d465
2 changed files with 9 additions and 2 deletions

View File

@ -109,7 +109,7 @@ namespace libtorrent
};
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);
TORRENT_EXPORT void rename(std::string const& f
, std::string const& newf, error_code& ec);

View File

@ -135,10 +135,17 @@ BOOST_STATIC_ASSERT((libtorrent::file::no_buffer & libtorrent::file::attribute_m
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)
{
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
std::wstring f = convert_to_wstring(inf);