summaryrefslogtreecommitdiff
path: root/zen/dir_watcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zen/dir_watcher.cpp')
-rw-r--r--zen/dir_watcher.cpp9
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,
bgstack15