From 183e4bcefbc6cb09917af339135f2ff1181116b2 Mon Sep 17 00:00:00 2001 From: Lunatic174 Date: Thu, 25 Oct 2018 23:58:20 +0500 Subject: [PATCH] Fix event args generation for FileSystemWatcher of the WatchingResolvePathTemplateManager The FileSystemEventArgs takes as argument directory path, not the full path to the file. --- .../Templating/WatchingResolvePathTemplateManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/source/RazorEngine.Core/Templating/WatchingResolvePathTemplateManager.cs b/src/source/RazorEngine.Core/Templating/WatchingResolvePathTemplateManager.cs index 7aff5d48..9757a8a0 100644 --- a/src/source/RazorEngine.Core/Templating/WatchingResolvePathTemplateManager.cs +++ b/src/source/RazorEngine.Core/Templating/WatchingResolvePathTemplateManager.cs @@ -83,8 +83,8 @@ void watcher_Changed(object sender, FileSystemEventArgs e) void watcher_Renamed(object sender, RenamedEventArgs e) { - watcher_Changed(sender, new FileSystemEventArgs(WatcherChangeTypes.Deleted, e.OldFullPath, e.OldName)); - watcher_Changed(sender, new FileSystemEventArgs(WatcherChangeTypes.Created, e.FullPath, e.Name)); + watcher_Changed(sender, new FileSystemEventArgs(WatcherChangeTypes.Deleted, Path.GetDirectoryName(e.OldFullPath) ?? e.OldFullPath, e.OldName)); + watcher_Changed(sender, new FileSystemEventArgs(WatcherChangeTypes.Created, Path.GetDirectoryName(e.FullPath) ?? e.FullPath, e.Name)); } ///