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.
This commit is contained in:
ema
2025-10-29 21:25:30 +08:00
parent d5655376f6
commit 5caaf749f7

View File

@@ -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;
}