ini "stacking", default values

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
junior013
Junior Member
Junior Member
Posts: 12
Joined: 2018-01-24, 09:01 UTC

ini "stacking", default values

Post by *junior013 »

TC can use system wide .ini from program dir or windows dir OR user specific .ini from users profile.
How can I specify system wide default values for some ini attributes, but let users to set their own?
Can be the .ini files "stackable"? Load values from system wide .ini first, but load users .ini over it too.

Or is there any possibility to set some system wide defaults?
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Sorry, there is no such stacking, every INI section may only be read from one INI file.
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

I really like the idea of stacked settings :-)

There is already a mechanism in TC that let the user use a section of settings from a common place and define settings for each user for other sections.
Let's say we have a content plugin section

Wincmd.ini (old)

Code: Select all

[ContentPlugins]
0=%COMMANDER_PATH%\Plugins\DateNames\DateNames.wdx
1=%COMMANDER_PATH%\Plugins\xPDFSearch\xPDFSearch.wdx
1_detect="EXT="PDF""
Wincmd.ini (new)

Code: Select all

[ContentPlugins]
RedirectionSection=%ALLUSERSPROFILE%\Ghisler\Common_Wincmd.ini
Common_Wincmd.ini

Code: Select all

[ContentPlugins]
0=%COMMANDER_PATH%\Plugins\DateNames\DateNames.wdx
1=%COMMANDER_PATH%\Plugins\xPDFSearch\xPDFSearch.wdx
1_detect="EXT="PDF""
This way you manage plugins for all users.
Though this mechanism solves quite a few problems I guess real stacking is still a good idea.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Perhaps something like RedirectionSectionIfMissing section parameter and common AlternateUserIniIfMissing parameter could be added for such task.

BTW not all sections may be appended, e.g. mentioned ContentPlugins section contains incremental values so adding an entry to common section after adding plugins to user section will cause problems.
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2MVV
Perhaps something like RedirectionSectionIfMissing section parameter and common AlternateUserIniIfMissing parameter could be added for such task.
I don't think something that works on a section-level will solve the task.
BTW not all sections may be appended, e.g. mentioned ContentPlugins section contains incremental values so adding an entry to common section after adding plugins to user section will cause problems.
Good point - but of course a program that reads both sections could easily merge the indices in a meaningful way.

There are other problems to solve - like where to store settings - common or top level ini file?
When the user changes setting A which is defined in top level in file, it must be insured that setting B on the same page, which is defined only in the common ini file, isn't saved.
A simple way to solve this would be to completely separate the configuration user interface. As in other programs where you can save global and project settings, a dropdown field could be displayed in the settings dialog displaying the currently edited ini file (top level by default). The user could then change this to the common ini file.
junior013
Junior Member
Junior Member
Posts: 12
Joined: 2018-01-24, 09:01 UTC

Post by *junior013 »

Lefteous wrote:There are other problems to solve - like where to store settings - common or top level ini file?
When the user changes setting A which is defined in top level in file, it must be insured that setting B on the same page, which is defined only in the common ini file, isn't saved.
I think it can be a good solution to follow a way like Mozilla: There can be default values in common config (which can user override) and protected values (user can't override).
Settings changed in a user session must be saved in the users profile (admins can copy them manually to the common ini if needed)
junior013
Junior Member
Junior Member
Posts: 12
Joined: 2018-01-24, 09:01 UTC

Post by *junior013 »

Lefteous wrote:There is already a mechanism in TC that let the user use a section of settings from a common place and define settings for each user for other sections.
Thanks for the idea! This RedirectSection is undocumented in wiki, but it works.
It's still a problem, that it starts from the users ini, so a new users fresh ini still not contain the required common section :/ (but I can work with it)
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2junior013
It's still a problem, that it starts from the users ini, so a new users fresh ini still not contain the required common section :/ (but I can work with it)
I guess the best way to prepare default settings for new accounts is to copy a template wincmd.ini to the 'Default User' user profile.
User avatar
petermad
Power Member
Power Member
Posts: 14700
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

RedirectSection is undocumented in wiki,
But it is documented in the Help:
RedirectSection= See description of AlternateUserIni. Note: When placed in the [Configuration] section, all variables of this section will be redirected, except for AlternateUserIni and UseIniInProgramDir, which will always be read from the main ini file.
AlternateUserIni=<somename.ini> If present, it will redirect storing of all user-changeable sections to an alternate ini file (in this example, somename.ini), except for the following sections: [Configuration], [Layout], [Packer], [Confirmation], [Extensions], [Associations], [Shortcuts], [ShortcutsWin], [PackerPlugins], [FileSystemPlugins], [ListerPlugins], [ContentPlugins]. These sections can be redirected individually, though:
In each section, an entry RedirectSection= can be added to change the default behaviour. It will allow to redirect (or not) this section to another ini file: Possible values:
0: no redirect
1: redirect to ini file defined via AlternateUserIni=<alternate ini file.ini>
<ininame.ini>: redirect to that specific ini
UseIniInProgramDir=0 This variable will only be read if the wincmd.ini is located in the same dir as the program. It must be put in wincmd.ini directly, RedirectSection has no effect on this variable.
It is the sum of the following values:
1: Use wincmd.ini in program dir if no other location is set via registry or parameters
2: Use wcx_ftp.ini in program dir if no other location is set via registry or parameters
4: Override registry settings (but not command line parameters)
I suggest to redirect these sections to user-specific ini-files:

Code: Select all

[ButtonbarCache]
[user]
[DirMenu]
[attrplugin]
[rename]
[SyncOptions]
[Selection]
[SearchName]
[SearchIn]
[SearchText]
[RenameTemplates]
[RenameSearchFind]
[RenameSearchReplace]
[left]
[right]
[lefttabs]
[righttabs]
[Command line history]
[RightHistory]
[LeftHistory]
[MkDirHistory]
[NewFileHistory]
[AllResolutions]
[PluginDuplicates]
[DirSelection]
and any:
[WxH (8x16)]
or just use the AlternateUserIni parameter.

You might also consider this parameter:
RestrictInterface= Disable parts of the user interface. Just build the sum of the following options:
1=Start menu
2=Command line
4=Buttonbar change
8=Drive right click menu
16=File right click menu
32=Directory hotlist change
64=FTP (CTRL+N, CTRL+F)
128=ENTER key (run programs, open files)
256=File system plugins
512=Port connection (via USB or LPT)
1024=Disable update checks (manual and automatic)
4 and 32 might be handy to prevent users from changing button bar and Directory hotlist
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply