diff options
author | Daniel Wilhelm <daniel@wili.li> | 2016-05-24 22:10:57 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2016-05-24 22:10:57 +0200 |
commit | 9043b32bb1835628c5a1d8be4a271c848443c629 (patch) | |
tree | 98ccb4936562731d9cae02a486441dfd446e8a4e /zen/dir_watcher.cpp | |
parent | 8.0 (diff) | |
download | FreeFileSync-9043b32bb1835628c5a1d8be4a271c848443c629.tar.gz FreeFileSync-9043b32bb1835628c5a1d8be4a271c848443c629.tar.bz2 FreeFileSync-9043b32bb1835628c5a1d8be4a271c848443c629.zip |
8.1
Diffstat (limited to 'zen/dir_watcher.cpp')
-rw-r--r-- | zen/dir_watcher.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/zen/dir_watcher.cpp b/zen/dir_watcher.cpp index 702a8e32..bb78939f 100644 --- a/zen/dir_watcher.cpp +++ b/zen/dir_watcher.cpp @@ -564,9 +564,12 @@ DirWatcher::DirWatcher(const Zstring& dirPath) : baseDirPath(dirPath), pimpl_(std::make_unique<Pimpl>()) { - CFStringRef dirpathCf = osx::createCFString(baseDirPath.c_str()); //returns nullptr on error - if (!dirpathCf) - throw FileError(replaceCpy(_("Cannot monitor directory %x."), L"%x", fmtPath(baseDirPath)), L"Function call failed: createCFString"); //no error code documented! + CFStringRef dirpathCf = nullptr; + try + { + dirpathCf = osx::createCFString(baseDirPath.c_str()); //throw SysError + } + catch (const SysError& e) { throw FileError(replaceCpy(_("Cannot monitor directory %x."), L"%x", fmtPath(baseDirPath)), e.toString()); } ZEN_ON_SCOPE_EXIT(::CFRelease(dirpathCf)); CFArrayRef dirpathCfArray = ::CFArrayCreate(nullptr, //CFAllocatorRef allocator, |