storage fix for locale dependent filename encoding

This commit is contained in:
Arvid Norberg 2009-04-13 01:03:33 +00:00
parent c3dce7c91b
commit fb5ef271cd
1 changed files with 5 additions and 3 deletions

View File

@ -259,7 +259,7 @@ namespace libtorrent
#if TORRENT_USE_WPATH #if TORRENT_USE_WPATH
fs::wpath f = convert_to_wstring((p / i->path).string()); fs::wpath f = convert_to_wstring((p / i->path).string());
#elif TORRENT_USE_LOCALE_FILENAMES #elif TORRENT_USE_LOCALE_FILENAMES
fs::path f = convert_to_native(p / i->path); fs::path f = convert_to_native((p / i->path).string());
#else #else
fs::path f = p / i->path; fs::path f = p / i->path;
#endif #endif
@ -610,7 +610,11 @@ namespace libtorrent
for (; i != end; ++i) for (; i != end; ++i)
{ {
bool file_exists = false; bool file_exists = false;
#if TORRENT_USE_LOCALE_FILENAMES
fs::path f = convert_to_native((m_save_path / i->path).string());
#else
fs::path f = m_save_path / i->path; fs::path f = m_save_path / i->path;
#endif
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
try try
{ {
@ -618,8 +622,6 @@ namespace libtorrent
#if TORRENT_USE_WPATH #if TORRENT_USE_WPATH
fs::wpath wf = convert_to_wstring(f.string()); fs::wpath wf = convert_to_wstring(f.string());
file_exists = exists(wf); file_exists = exists(wf);
#elif TORRENT_USE_LOCALE_FILENAMES
file_exists = exists(convert_to_native(f.string()));
#else #else
file_exists = exists(f); file_exists = exists(f);
#endif #endif