Page 1 of 1

Variables in RedirectSection?

Posted: 2007-03-06, 16:17 UTC
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"

Posted: 2007-03-06, 16:30 UTC
by Lefteous
2KyleK
Is it possible to use (environment) variables/placeholders for the RedirectSection=<ininame> setting?
Yes that works fine - just try it.

Posted: 2007-03-06, 17:40 UTC
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?

Posted: 2007-03-06, 17:54 UTC
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.

Posted: 2007-03-06, 18:48 UTC
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.

Posted: 2007-03-09, 20:26 UTC
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).

Posted: 2007-03-09, 20:33 UTC
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.