Notepad3 icon indicating copy to clipboard operation
Notepad3 copied to clipboard

Cannot save settings if the settings file/folder does not already exist.

Open lss4 opened this issue 1 year ago • 0 comments

TL;DR: This is an issue made apparent by how Windows behaves when using a pure standard user (that does not have any Administrator privilege, requiring a separate Administator account for elevated actions). Such issue is unlikely to naturally occur with a user account that does have Administrator privileges.

It appears if the settings file (%APPDATA%\Rizonesoft\Notepad3\Notepad3.ini) does not already exist, Notepad3 would use default settings, but changes cannot be saved on exit (with no error message). Attempting to manually save using F7 in this case would give me just an error message. As the error message did not explain the detail, it took me a while to figure out why. Perhaps it would be better to just try recreating the configuration file (and folder) and error only if it still could not do so.

Context: I just set up a Win10 system modded using AME 10 Playbook, which has an option called Enhanced Security. Simply put, that option would remove admin rights from other accounts and enable the built-in Administrator (as well as setting its own password). With that enabled, any action requiring elevated rights from that point on would require you to enter Administrator's password to proceed.

And here's the problem. When you elevated this way, you effectively become Administrator for the scope of the elevated program, and any action from the program involving the user profile folder would go in to C:\Users\Administrator instead of your own, which would lead to all kinds of problems especially with installers, as it will end up creating user profiles in the wrong place.

In this case, I installed Notepad3 through Chocolatey using default options. As Chocolatey has to be run as Administrator, so were the installer, which created the default profile to C:\Users\Administrator\AppData\Roaming\Rizonesoft\Notepad3 instead of my own folder. As such, Notepad3 was unable to save any settings for my user, until I copied the files from Adminstrator's profile folder to my own, and settings can be saved properly since then.

lss4 avatar Jan 02 '24 12:01 lss4