summaryrefslogtreecommitdiff
path: root/lib/resolve_path.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:17:25 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:17:25 +0200
commit94e1d2e78b6ff92d5a1c971c277cb6ac792d1c70 (patch)
tree338d2ab72f79901f5d32c96d63cec36f30bcf44e /lib/resolve_path.cpp
parent4.4 (diff)
downloadFreeFileSync-94e1d2e78b6ff92d5a1c971c277cb6ac792d1c70.tar.gz
FreeFileSync-94e1d2e78b6ff92d5a1c971c277cb6ac792d1c70.tar.bz2
FreeFileSync-94e1d2e78b6ff92d5a1c971c277cb6ac792d1c70.zip
4.5
Diffstat (limited to 'lib/resolve_path.cpp')
-rw-r--r--lib/resolve_path.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/resolve_path.cpp b/lib/resolve_path.cpp
index feeb98e3..df65b98b 100644
--- a/lib/resolve_path.cpp
+++ b/lib/resolve_path.cpp
@@ -5,6 +5,7 @@
#include <map>
#include <set>
#include <zen/scope_guard.h>
+#include <zen/thread.h>
#ifdef FFS_WIN
#include <zen/dll.h>
@@ -354,6 +355,7 @@ Zstring volumenNameToPath(const Zstring& volumeName) //return empty string on er
#ifdef FFS_WIN
+//attention: this call may seriously block if network volume is not available!!!
Zstring volumePathToName(const Zstring& volumePath) //return empty string on error
{
const DWORD bufferSize = MAX_PATH + 1;
@@ -440,9 +442,14 @@ void getDirectoryAliasesRecursive(const Zstring& dirname, std::set<Zstring, Less
dirname[1] == L':' &&
dirname[2] == L'\\')
{
- Zstring volname = volumePathToName(Zstring(dirname.c_str(), 3));
- if (!volname.empty())
- output.insert(L"[" + volname + L"]" + Zstring(dirname.c_str() + 2));
+ //attention: "volumePathToName()" will seriously block if network volume is not available!!!
+ boost::unique_future<Zstring> futVolName = zen::async([=] { return volumePathToName(Zstring(dirname.c_str(), 3)); });
+ if (futVolName.timed_wait(boost::posix_time::seconds(1)))
+ {
+ Zstring volname = futVolName.get();
+ if (!volname.empty())
+ output.insert(L"[" + volname + L"]" + Zstring(dirname.c_str() + 2));
+ }
}
//2. replace volume name by volume path: [SYSTEM]\dirname -> c:\dirname
bgstack15