Problems with relative path to wincmd.ini

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Problems with relative path to wincmd.ini

Post by *Usher »

Suppose you have installed TC in C:\TotalCmd and you want to make tests with a fresh ini. Do the following steps
1. Create directory for test ini:

Code: Select all

md c:\test
2. Run the following command:

Code: Select all

C:\TotalCmd\TotalCmd64.exe /i=\test\wincmd.ini
or for 32-bit TC:

Code: Select all

C:\TotalCmd\TotalCmd.exe /i=\test\wincmd.ini
3. Accept all settings and start to play with TC:
a) press Ctrl+T to open a new tab in the left panel, go to some directory and navigate down to some file
b) press Tab to go to the right panel, and repeat actions with opening a new tab.
4. Close TC.
5. Open TC again using command from p.2. You can see NO tabs saved. You can press Alt+Down or Alt+Shift+Down and you can see NO history saved.

By default all tabs and navigation history should be saved in wincmd.ini, but they are NOT in this case. You can open C:\test\wincmd.ini and see that the following sections are missing:
[lefttabs]
[righttabs]
[LeftHistory]
[RightHistory]
You can search all the C: partition to ensure that there are no other new wincmd.ini created.

I haven't tested whether the problem exists for other sections. Instead, I have repeated a test with another partition.
6. Create directory on partition D:

Code: Select all

md d:\test
7. Run TC with the command from p.2.
8. Open new tabs in the left panel as in p.3a)
9. Open Options, change some settings, apply them and click OK to close the Options window.
10. Go to the right panel and change drive to D:
11. Now open new tabs in the right panel as in p.3b), but on drive D: only.
12. Open Options, change some other settings, apply them and click OK to close the Options window.
13. Close TC.
14. Open TC again as in p.2. You know that there are no tabs saved, but you can see that some configuration changes are also missing.
15. Check the content of both C:\test and d:\test directories. You should see wincmd.ini in both ones. When you are navigating on drive C:, settings are saved to C:\test\wincmd.ini, when navigating on drive D:, settings are saved to D:\test\wincmd.ini.
16. Open Help -> About Total Commander and you can see that TC does NOT make canonicalization to full path and filename.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with relative path to wincmd.ini

Post by *ghisler(Author) »

Sorry, relative paths are not supported here. Use something like %commander_path% or %commander_drive% instead.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4576
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Problems with relative path to wincmd.ini

Post by *white »

ghisler(Author) wrote: 2022-06-24, 06:57 UTC Sorry, relative paths are not supported here. Use something like %commander_path% or %commander_drive% instead.
And instead of %commander_path% you can also use ".\" which will also work outside of Total Commander.
Examples:

Code: Select all

C:\TotalCmd\TotalCmd64.exe /i=.\wincmd.ini
C:\TotalCmd\TotalCmd64.exe /i=.\my_cfgs\tc.ini /F=.\my_cfgs\tc_ftp.ini
(".\" is replaced by the path of the Total Commander executable and no further canonicalization is performed)
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Problems with relative path to wincmd.ini

Post by *Usher »

ghisler(Author) wrote: 2022-06-24, 06:57 UTC Sorry, relative paths are not supported here. Use something like %commander_path% or %commander_drive% instead.
Those %variables% don't work outside of TC. You can't use them to start portable TC from pendrives.
white wrote: 2022-06-24, 11:00 UTCAnd instead of %commander_path% you can also use ".\" which will also work outside of Total Commander.
Imagine users making a typo as it was originally in my case. They may be unpleasantly surprised when their config disappears.
Andrzej P. Wozniak
Polish subforum moderator
JOUBE
Power Member
Power Member
Posts: 1433
Joined: 2004-07-08, 08:58 UTC

Re: Problems with relative path to wincmd.ini

Post by *JOUBE »

Usher wrote: 2022-06-26, 16:16 UTCImagine users making a typo as it was originally in my case. They may be unpleasantly surprised when their config disappears
Typos are not supported, thats all.

JOUBE
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Problems with relative path to wincmd.ini

Post by *Usher »

2JOUBE
Neither are jokes.
Thanks from the mountain.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with relative path to wincmd.ini

Post by *ghisler(Author) »

Moderator message

Moved to "will not be changed"
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Problems with relative path to wincmd.ini

Post by *Usher »

There's still no explanation why some sections aren't saved in such cases.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with relative path to wincmd.ini

Post by *ghisler(Author) »

Because Windows functions resolve relative paths not relative to the program, but to the current directory, which may be on a completely different drive at this time.
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Problems with relative path to wincmd.ini

Post by *Usher »

I have taken it into account before sending report. That's why the first test was only on drive C: - and it failed no matter what directory on drive C: I made current. So it's not a real explanation IMHO.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with relative path to wincmd.ini

Post by *ghisler(Author) »

Sorry, I don't have the source code of Windows, so I can't look up the inner working of the *PrivateProfileString* functions.
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Problems with relative path to wincmd.ini

Post by *Usher »

2ghisler(Author)
Windows functions are not the problem I have reported.
The problem is in TC itself. Some ini sections are saved:

Code: Select all

[Configuration]
[ButtonbarCache]
[1920x1080 (8x16)]
[Layout]
[Lister]
[Colors]
[Tabstops]
[Packer]
[Confirmation]
[Buttonbar]
[DirMenu]
[left]
[right]
Some other sections are NOT saved at all, in any place on any partition:

Code: Select all

[lefttabs]
[righttabs]
[RightHistory]
[LeftHistory]
What is wrong with these sections?
Andrzej P. Wozniak
Polish subforum moderator
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48005
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Problems with relative path to wincmd.ini

Post by *ghisler(Author) »

The lower sections are stored as a whole with WritePrivateProfileSection.
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Problems with relative path to wincmd.ini

Post by *Usher »

So what? Is it anything wrong with a proper handle to ini? The missing sections should be saved earlier, I think.
Andrzej P. Wozniak
Polish subforum moderator
Post Reply