Variables in RedirectSection?

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
KyleK
Junior Member
Junior Member
Posts: 64
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Variables in RedirectSection?

Post by *KyleK »

Hi everyone,

Is it possible to use (environment) variables/placeholders for the RedirectSection=<ininame> setting?

I'd like to put several sections of the .ini into user-specific files dependant on the account they're logged onto.
So "RedirectSection=%commanderpath%\settings_%user%.ini" would be changed to "RedirectSection="c:\program files\settings_KyleK.ini"
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2KyleK
Is it possible to use (environment) variables/placeholders for the RedirectSection=<ininame> setting?
Yes that works fine - just try it.
User avatar
KyleK
Junior Member
Junior Member
Posts: 64
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Post by *KyleK »

Hm,

I tried:

RedirectSection=wincmd_%USERNAME%.ini
RedirectSection=wincmd_%USER%.ini
RedirectSection=wincmd_%USERPROFILE%.ini

(though the last one was a mistake by me, it makes no sense at all).

None of these work. Checking file access with SysInternal's Filemon, Total Commander tries to open the file "wincmd_%USERNAME%.ini"
The variable does not get resolved.

Am I doing something wrong?
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2KyleK
RedirectSection=wincmd_%USERNAME%.ini
RedirectSection=wincmd_%USER%.ini
Indeed these examples really doesn't work although they should. It seems environment strings are only supported if the result is an absolute path. Use absolute paths for the time being.
BTW: I personally use %appdata% to load TC (totalcmd.exe /i=%appdata%\tc.ini) so I don't have to mess around with per user settings in redirectsection.

Developer summary: This is a bug because ExpandEnvironmentStrings expands also these kind of paths. I have tested it.
User avatar
KyleK
Junior Member
Junior Member
Posts: 64
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Post by *KyleK »

Thanks,

I used absolute paths now and it works as expected.
I thought about using %appdata% but I'd rather have all stuff used by Total Commander in one place (=not the system partition).
Using the AppData folder would mean 2 more files to backup when I need to reinstall.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Actually it does work, but when you give no absolute path, the files will be found in the Windows directory (where you probably don't have write access).
Author of Total Commander
https://www.ghisler.com
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2ghisler(Author)
No for just file names TC looks in the same directory as Wincmd.ini. Please try this - file names which include environment strings are not resolved.
Post Reply