attempt to fix unc paths on windows

This commit is contained in:
Arvid Norberg 2012-03-03 21:51:15 +00:00
parent 5a8037dba2
commit 92fba05040
1 changed files with 8 additions and 9 deletions

View File

@ -801,20 +801,19 @@ namespace libtorrent
FILE_SHARE_READ,
};
#if TORRENT_USE_WSTRING
#define CreateFile_ CreateFileW
m_path = convert_to_wstring(path);
#if TORRENT_USE_UNC_PATHS
// UNC paths must be absolute
std::string p = "\\\\?\\" + (is_complete(path) ? path : combine_path(current_working_directory(), path));
#else
#define CreateFile_ CreateFileA
m_path = convert_to_native(path);
std::string const& p = path;
#endif
#if TORRENT_USE_UNC_PATHS
#if TORRENT_USE_WSTRING
m_path = L"\\\\?\\" + m_path;
#define CreateFile_ CreateFileW
m_path = convert_to_wstring(p);
#else
m_path = "\\\\?\\" + m_path;
#endif // TORRENT_USE_WSTRING
#define CreateFile_ CreateFileA
m_path = convert_to_native(p);
#endif
TORRENT_ASSERT((mode & rw_mask) < sizeof(mode_array)/sizeof(mode_array[0]));