Clean up: Use "enforce"
This commit is contained in:
parent
382a8d8a11
commit
3ebb065509
|
@ -647,8 +647,7 @@ struct DirectoryWatcher { // TODO: avoid all those heap allocations!
|
||||||
m_context = new Context; // FIME: avoid GC allocation (use FD user data slot)
|
m_context = new Context; // FIME: avoid GC allocation (use FD user data slot)
|
||||||
m_context.changeEvent = createManualEvent();
|
m_context.changeEvent = createManualEvent();
|
||||||
m_watcher = eventDriver.watchers.watchDirectory(path.toNativeString, recursive, &m_context.onChange);
|
m_watcher = eventDriver.watchers.watchDirectory(path.toNativeString, recursive, &m_context.onChange);
|
||||||
if (m_watcher == WatcherID.invalid)
|
enforce(m_watcher != WatcherID.invalid, "Failed to watch directory.");
|
||||||
throw new Exception("Failed to watch directory.");
|
|
||||||
m_context.path = path;
|
m_context.path = path;
|
||||||
m_context.recursive = recursive;
|
m_context.recursive = recursive;
|
||||||
m_context.changes = appender!(DirectoryChange[]);
|
m_context.changes = appender!(DirectoryChange[]);
|
||||||
|
|
Loading…
Reference in a new issue