lhmouse / nano-win

GNU nano text editor for Windows [WARNING: The master branch is constantly rebased and force-pushed so don't expect it to be steady!! -end WARNING]
https://files.lhmouse.com/nano-win/
GNU General Public License v3.0
210 stars 25 forks source link

Improve nanorc finding heuristics. #44

Open rkitover opened 2 years ago

rkitover commented 2 years ago

Fix #43

For non-elevated users, search for the config file in this order:

  1. %ALLUSERSPROFILE%\nano\nanorc (global)
  2. %SystemRoot%\nanorc (global, for backcompat, should be removed in the future)
  3. %USERPROFILE%.nanorc
  4. %APPDATA%\nano\nanorc

For elevated users, the order is:

  1. %ALLUSERSPROFILE%\nano\elevated_nanorc
  2. %ALLUSERSPROFILE%\nanorc (for backcompat, should be removed later)

Signed-off-by: Rafael Kitover rkitover@gmail.com

rkitover commented 2 years ago

The logic of the function is a bit disjointed because I tried to keep the original structure, but I can rewrite it if you want.

Also when elevated the global config locations are not checked, they were previously, but I thought if your intent is to separate elevated and non-elevated configs they shouldn't be.

lhmouse commented 2 years ago

I will have a look a couple of days later.