2all plugin authors: INI file location

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

2all plugin authors: INI file location

Post by *Lefteous »

This problem has been discussed quite often but it's time to find a solution.
The problems in short:
- Users want to have all INI files in one place, other users want them inside the plugin directory and so on.
- Security attributes avoid writing to certain locations.

I think I found a solution that is flexible enough for both users and plugin developers.

Searching for the setting file location:

Introduce a developer defined oder where to search for the settings file. This is an example and plugin developers could use different orders. But of course it's important that some well known locations are implemented.

1. .\MyPlugin\MyPlugin.ini (relative to the Wincmd.ini directory)
2. .\MyPlugin.ini (relative to the Wincmd.ini directory)
3. .\Settings\MyPlugin.ini (relative to the plugin directory)
4. .\MyPlugin.ini (relative to the plugin directory)
5. .\MyPlugin.ini (relative to Total Commander directory).

The plugin searches in this hierarchy for the INI file. When it has found it and access rights allow reading and writing the ini file will be apllied as INI file location. Otherwise the next location is checked for these requirements and so on.

The advantage of this solution is that the user can just move the file which is located at the location determined by the plugin to the the desired location. The plugin will continue to work using the existing setting file without any additional INI settings or whatever.
Post Reply