Skip to content

Commit 3a01f0c

Browse files
committed
app: Check if file can is opened before monitoring a file (potential fix for #695)
1 parent 45a64d9 commit 3a01f0c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CodeApp/Utilities/file/DirectoryFolderMonitor.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ class FolderMonitor {
6666
func startMonitoring() {
6767
guard folderMonitorSource == nil && monitoredFolderFileDescriptor == -1 else {
6868
return
69-
7069
}
7170
// Open the directory referenced by URL for monitoring only.
7271
monitoredFolderFileDescriptor = open(url.path, O_EVTONLY)
7372

73+
guard monitoredFolderFileDescriptor != -1 else { return }
74+
7475
// Define a dispatch source monitoring the directory for additions, deletions, and renamings.
7576
folderMonitorSource = DispatchSource.makeFileSystemObjectSource(
7677
fileDescriptor: monitoredFolderFileDescriptor, eventMask: .write,

0 commit comments

Comments
 (0)