From 4c8e8470cde54b84f2a10f07f3c0a069758af3d8 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 18 Apr 2007 16:48:24 +0000 Subject: [PATCH] storage fix for unicode on windows --- src/storage.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/storage.cpp b/src/storage.cpp index 56a32e64a..c6dc3abf8 100755 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -774,13 +774,19 @@ namespace libtorrent bool supports_sparse_files(path const& p) { assert(p.is_complete()); -#if defined(WIN32) +#if defined(_WIN32) // assume windows API is available DWORD max_component_len = 0; DWORD volume_flags = 0; std::string root_device = p.root_name() + "\\"; +#if defined(UNICODE) + std::wstring wph(safe_convert(root_device)); + bool ret = ::GetVolumeInformation(wph.c_str(), 0 + , 0, 0, &max_component_len, &volume_flags, 0, 0); +#else bool ret = ::GetVolumeInformation(root_device.c_str(), 0 , 0, 0, &max_component_len, &volume_flags, 0, 0); +#endif if (!ret) return false; if (volume_flags & FILE_SUPPORTS_SPARSE_FILES)