Giter Site home page Giter Site logo

Comments (7)

rdipardo avatar rdipardo commented on September 26, 2024 1

The plugin's DLL name is NppMarkdownPanel.dll

I stand corrected. It seems that 9872e9f just changed the value of an internal class member. To really keep the help file path in sync, you would have to extract the directory name from the assembly's binary file information; something like this:

diff --git a/NppMarkdownPanel/MarkdownPanelController.cs b/NppMarkdownPanel/MarkdownPanelController.cs
index 5e37268..57c600f 100644
--- a/NppMarkdownPanel/MarkdownPanelController.cs
+++ b/NppMarkdownPanel/MarkdownPanelController.cs
@@ -8,6 +8,7 @@ using System.Drawing.Imaging;
 using System.IO;
 using System.Linq;
 using System.Runtime.InteropServices;
+using System.Diagnostics;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
@@ -209,9 +210,12 @@ namespace NppMarkdownPanel

         private void ShowHelp()
         {
+            var dll = (typeof(Main)).Assembly;
+            var dllVersionInfo = FileVersionInfo.GetVersionInfo(dll.Location);
+            string dllDir = Path.GetFileNameWithoutExtension(dllVersionInfo.OriginalFilename);
             StringBuilder sbPluginPath = new StringBuilder(Win32.MAX_PATH);
             Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETPLUGINHOMEPATH, Win32.MAX_PATH, sbPluginPath);
-            var helpFile = Path.Combine($"{sbPluginPath}", Main.PluginName, "README.md");
+            var helpFile = Path.Combine($"{sbPluginPath}", dllDir, "README.md");
             Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_DOOPEN, 0, helpFile);
             if (!isPanelVisible)
                 TogglePanelVisible();

from nppmarkdownpanel.

rdipardo avatar rdipardo commented on September 26, 2024

The installation folder depends on the JSON manifest bundled with Plugins Admin, so this issue really belongs here.

The help file path is built from the PluginName field; it's always in sync with the compiled assembly:

var helpFile = Path.Combine($"{sbPluginPath}", Main.PluginName, "README.md");

from nppmarkdownpanel.

dinkumoil avatar dinkumoil commented on September 26, 2024

@rdipardo

this issue really belongs here.

I don't agree. The plugin's DLL name is NppMarkdownPanel.dll, thus the folder it is stored into must be <Npp-folder>\plugins\NppMarkdownPanel. This should also be the folder where plugin's companion files and folders are stored. It seems like function Main.PluginName returns the string MarkdownPanel instead of NppMarkdownPanel, so the plugin searches its help files in the wrong folder.

I guess the bug derives from recent renaming of the plugin's menu entry from NppMarkdownPanel to MarkdownPanel in commit 9872e9f. When installing a plugin, PluginAdmin generates the target folder name from the name of the DLL file it finds at the root level of the plugin's ZIP package, not from the return value of plugin interface's function getName, simply because the plugin is not (and can not be) loaded during its installation, so this function cannot be called.

from nppmarkdownpanel.

mohzy83 avatar mohzy83 commented on September 26, 2024

Like @rdipardo said, the const Main.PluginName is used to construct the path to the help file.
It's much safer to use the directory of the executing assembly and dont rely on that constant.
I will change the implementation accordingly.

from nppmarkdownpanel.

mohzy83 avatar mohzy83 commented on September 26, 2024

fixed in version 0.7.3. @dinkumoil please verify. Thanks.

from nppmarkdownpanel.

rdipardo avatar rdipardo commented on September 26, 2024

It works.

nppMrkdPnl-2023-02-19-152121

from nppmarkdownpanel.

dinkumoil avatar dinkumoil commented on September 26, 2024

It works.

Confirmed.

from nppmarkdownpanel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.