From 5caaf749f75318a6cc247b64148735c12ca08be6 Mon Sep 17 00:00:00 2001 From: ema Date: Wed, 29 Oct 2025 21:25:30 +0800 Subject: [PATCH] Set _currentPath before file type check in View Moved assignment of _currentPath to the start of the View method to ensure it is set before any file type-specific logic is executed. This improves consistency and prevents potential issues with path-dependent operations. --- QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs index 7489304..2a024b9 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs @@ -70,6 +70,8 @@ public partial class Plugin : IViewer, IMoreMenu public void View(string path, ContextObject context) { + _currentPath = path; + if (path.EndsWith(".rtf", StringComparison.OrdinalIgnoreCase)) { var rtfBox = new RichTextBox(); @@ -86,7 +88,6 @@ public partial class Plugin : IViewer, IMoreMenu else { _tvp = new TextViewerPanel(); - _currentPath = path; _tvp.LoadFileAsync(path, context); context.ViewerContent = _tvp; }