%$LOCAL_APPDATA% can not be used for TreeFileLocation

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
thisisbug
Junior Member
Junior Member
Posts: 3
Joined: 2010-08-09, 13:27 UTC

%$LOCAL_APPDATA% can not be used for TreeFileLocation

Post by *thisisbug »

Hi!

I have added

TreeFileLocation=%$LOCAL_APPDATA%\Ghisler\treeinfo-%D%.wc

option to wincmd.ini. Unfortunately, TC does not create the tree file although folder %$LOCAL_APPDATA%\Ghisler exists.

On the other side %$LOCAL_APPDATA% can be used for thumbnails:

ThumbsLocation=%$LOCAL_APPDATA%\Ghisler
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Confirmed. I'm using same value here:

Code: Select all

TreeFileLocation=%$LOCAL_APPDATA%\GHISLER\tree_%D%.wc
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately only real environment variables are available in this function. I cannot use the special env replacement function because of the %D%, it would be mistaken for an env var too...
Author of Total Commander
https://www.ghisler.com
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hi, guys.

Though it will only help users of more recent Windows versions:
The "set" command revealed that Windows 7 exported the variable %LOCALAPPDATA% to the process environment.
%LOCALAPPDATA% has got the same content as %$LOCAL_APPDATA%.

Kind regards,
Karl
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Maybe it is possible to temporary mask special tree variables like %D% while calling envvar replacement function? E.g. %D% may be replaced with <D> and then after resolving envvars <D> may be replaced with drive letters.
thisisbug
Junior Member
Junior Member
Posts: 3
Joined: 2010-08-09, 13:27 UTC

Post by *thisisbug »

Ghisler, thank you for the answer. I agree with MVV that it is possible to distinguish between %D%, %SOMETHING_OTHER% and %$SOMETHING_WITH_DOLLAR_SIGH%.

karlchen, unfortunately Windows XP and Windows 2003 do not export %LOCAL_APPDATA%.
User avatar
karlchen
Power Member
Power Member
Posts: 4603
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hello, thisisbug.

As has been stated: more recent Windows versions. .... I knew that Windows XP and Windows 2003 would not qualify as more recent :wink: and therefore did not have %LOCALAPPDATA% in their globally accessible environment. :(

Kind regards,
Karlchen
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

In the code listed below,
  • Delete any SET's you don't want.
  • Save to a file, aka: RunTC.cmd
  • Create a Shortcut to RunTC.cmd
  • RightClick & Properties on the Shortcut,
  • Choose: Run Minimized
    • [Change Icon], select TotalCMD.exe for the ICON.
Then use that shortcut for launching TC.

This is a small section of my RunTC.cmd

Code: Select all

@ECHO OFF
SET APPLOCAL=%USERPROFILE%\Local Settings\Application Data
SET TC=%ProgramFiles%\TotalCMD
SET TCmd=%TC%\TotalCMD.exe
SET TCDATA=%APPDATA%\_TC_
SET TCTOOL=%wuBIN%\TCTools
SET TCMC=%TCTOOL%\TCMC.exe 50
:: junction -d "%TC%\Data"
:: junction "%TC%\Data" "%TCDATA%"
START "" "%TCmd%"
Notice we have SET APPLOCAL, and now you can use
%APPLOCAL%\Ghisler, in your wincmd.ini

You can get rid of all the set's if you prefer, just keep APPLOCAL and change the START line to
START "" "Full\Path\To\Your\Install\of\TotalCMD.exe"

The usefulness of setting these Environment Variables, Makes it so they can be used in your ButtonBar menu's, UserCommands, TC's command-line, etc etc.
Then if you reinstall your system or change your username or whatever, all you need to do is change a couple lines in your RunTC.cmd and all your data in wincmd.ini and buttonBars, etc, will be correct.
thisisbug
Junior Member
Junior Member
Posts: 3
Joined: 2010-08-09, 13:27 UTC

Post by *thisisbug »

Balderstrom, I know this workaround but it is like a crutch.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Thanks for supporting it in 7.56! :)

Code: Select all

TreeFileLocation=%$LOCAL_APPDATA%\GHISLER\tree_%D%.wc
Works great!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for testing it!
Author of Total Commander
https://www.ghisler.com
Post Reply