From 5a9f2716fdb2f6b545d02938d6cae002c5b30507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20M=C3=B8llegaard?= Date: Thu, 7 Oct 2021 22:01:58 +0200 Subject: [PATCH] Autocreate Scripts directory if missing Actually it will auto-create any directory you're monitoring --- Components/FileMonitor/Lua/FileMonitorInstanceThread.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Components/FileMonitor/Lua/FileMonitorInstanceThread.cs b/Components/FileMonitor/Lua/FileMonitorInstanceThread.cs index 9c6d1a3f..3dd83b7f 100644 --- a/Components/FileMonitor/Lua/FileMonitorInstanceThread.cs +++ b/Components/FileMonitor/Lua/FileMonitorInstanceThread.cs @@ -39,6 +39,9 @@ public FileMonitorInstanceThread( foreach (var path in paths) { + // Make sure directory exists, before monitoring it + Directory.CreateDirectory(path); + var watcher = new FileSystemWatcher(path); watcher.Created += (_, e) => WatcherOnCreated(e); watcher.Changed += (_, e) => WatcherOnChanged(e);