Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Load custom configuration from %AppData% #601

Open
Giresharu opened this issue Jan 10, 2025 · 3 comments
Open

[Feature Request] Load custom configuration from %AppData% #601

Giresharu opened this issue Jan 10, 2025 · 3 comments

Comments

@Giresharu
Copy link

Currently, all configuration files are located in the program directory, which leads to the following inconvenience:

  • It is not convenient to retain user configurations when reinstalling the system.
  • It is not convenient to restore the default configuration when custom settings are disrupted, as it is not straightforward to delete and modify the files to revert to the default state.
  • In recent versions of Windows, any edit in the C:\Program Files directory requires administrator privileges, which is not convenient for creating imports configurations or modifying existing nss configurations (if using VSCode, each save requires a very cumbersomeconfirmation box in the lower right corner + UAC confirmation box). Although you can directly start the editor in administrator mode, I think this is not very elegant.

I believe this configuration is more elegant:
For example, create a Nilesoft Shell directory in the user's %AppData%, the nss file and imports directory structure is the same as that in the program's main directory.
As long as there is a shell.nss in the directory, the shell.nss in the program's main directory will not be loaded.

@a4d8b3
Copy link
Contributor

a4d8b3 commented Jan 10, 2025

To achieve this type of setup you can:

  1. Rename shell.nss to shell.conf.nss or something similar.
  2. copy the configuration directory to %AppData%\Nilesoft Shell\
  3. Create a new shell.nss in the main Program Files directory: C:\Program Files\Nilesoft Shell
  4. Add the following:
$usr_conf='@user.appdata\Nilesoft Shell\shell.conf.nss'
import if(path.exists(usr_conf),usr_conf,'shell.conf.nss')

As for making this sort of configuration default - take a look at: #449 (comment).

@Giresharu
Copy link
Author

Giresharu commented Jan 10, 2025

To achieve this type of setup you can:

  1. Rename shell.nss to shell.conf.nss or something similar.
  2. copy the configuration directory to %AppData%\Nilesoft Shell\
  3. Create a new shell.nss in the main Program Files directory: C:\Program Files\Nilesoft Shell
  4. Add the following:
$usr_conf='@user.appdata\Nilesoft Shell\shell.conf.nss'
import if(path.exists(usr_conf),usr_conf,'shell.conf.nss')

As for making this sort of configuration default - take a look at: #449 (comment).

Thank you for your response!

However, I feel that deleting the original content of shell.nss might be somewhat detrimental to the subsequent restoration of the default configuration. This would still require manual backup of the original settings.

Regarding the reason mentioned in #449 (comment) for not using Appdata, I hold a different view:

Those who can edit nss for customization generally possess a certain level of programming skills, and those who are unaware of appdata can be considered a tiny minority. Even if we need to cater to this group, there are multiple ways to handle it, such as: providing an option to "clear old configurations in Appdata" during installation and uninstallation, or allowing users to manually select a custom configuration directory option (including placing it directly under the main directory).

This way, it can separate the custom configurations of users who need them from the default configurations to achieve a fallback effect, while also ensuring that users who don't understand don't have to worry about where the configuration files are hidden, a win-win situation.

Of course, that's just my personal opinion. Deciding the direction of the software ultimately depends on the author.

@moudey
Copy link
Owner

moudey commented Jan 11, 2025

With these settings, the shell loads the configuration file from a custom path.
If it does not find the configuration file, it looks for the default configuration file "shell.nss" in the program folder.

[HKEY_CURRENT_USER\Software\Nilesoft\Shell]
"config"="path\\to\\shell.nss"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants