d0vgan / nppexec

NppExec (plugin for Notepad++)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changing N++ themes results in error

vinsworldcom opened this issue · comments

commented

Testing the new Notepad++ 8.4.8 RC2.

Start from fresh Notepad++ 64-bit portable RC2.

  1. Plugin Admin - install NppExec
  2. After confirming and N++ restarts, go to Plugins => NppExec => Follow $(CURRENT_DIRECTORY) [Ensure this shows a checkmark in the menu]
    image
  3. Notepad++ menu Settings => Style Configurator... => Select theme dropdown box - pick any theme.
    image

This may be due to the themes now using relative paths instead of absolute paths as of this commit.

See further discussion.

Cheers.

NppExec's Follow $(CURRENT_DIRECTORY) changes the current directory automatically, following the current document's directory.
NppExec's command cd changes the current directory manually.
I believe some other plugins may allow to change the current directory as well, and there is nothing wrong with changing of the current directory when you have exactly the same purpose (to change the current directory).
So I'd rather say that Notepad++'s implementation of "relative directory" is incorrect. With respect to themes, I'd expect the following from Notepad++:

  1. It checks a full path to Notepad++'s user folder, appending the relative path of "themes<ThemeName>.xml". For example, it may be checking for "D:\Users\Vitalii\Notepad++\themes\Bespin.xml".
  2. It checks a full path to Notepad++'s home folder (where "notepad++.exe" is located), appending the relative path of "themes<ThemeName>.xml". For example, it may be checking for "C:\Program Files\Notepad++\themes\Bespin.xml".

In both these cases, if the code was written in such way, whatever the current directory is, Notepad++ would always check its user folder and its home folder, searching for relative theme path under these folders and only these folders.
However, it looks like Notepad++ tries to find a path relative to the current folder that can be any possible folder in general. For example, I may go to the root of the drive "D:" using the command line and, from the root of the drive "D:", I can type: "C:\Program Files\Notepad++\notepad++.exe". This will start Notepad++ with "D:" as its current directory. Does it mean that Notepad++ should search for its theme files under "D:\themes"? I don't think so.

commented

@ozone10 - is this how Notepad++ new relative path for themes works?

commented

For example, I may go to the root of the drive "D:" using the command line and, from the root of the drive "D:", I can type: "C:\Program Files\Notepad++\notepad++.exe". This will start Notepad++ with "D:" as its current directory. Does it mean that Notepad++ should search for its theme files under "D:\themes"? I don't think so.

And that's exactly what happens!

@d0vgan thank you for the explanation. Using your example, I've detailed a way to produce the issue without NppExec being installed and updated it in the Notepad++ commit discussion referenced above. Seems you may be right about relative paths implementation not being robust enough.

Cheers.

commented

@d0vgan seems you are right! Notepad++ devs just pushed a fix that I tested sucessfully:

notepad-plus-plus/notepad-plus-plus#12671 (comment)