cannot wrtie user.ini

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

Moderators: Hacker, petermad, Stefan2, white

FForever
Junior Member
Junior Member
Posts: 6
Joined: 2024-07-26, 08:35 UTC

cannot wrtie user.ini

Post by *FForever »

Hello! I use the "RedirectSection" to make the "[dirmenu]" to the file named user.ini for convenience. But everytime i add thing to hotlist using the "add to submenu" option, it will show error that cannot write user.ini, please remove the write protection. And the strange thing is that it had been add to the hotlist and user.ini. The same when i start with administrator privileges. The version is 11.03, Windows 10 22H2. The following is my settings, thx.
wincmd.ini
[DirMenu]
RedirectSection=%COMMANDER_PATH%\User\User.ini

User.ini
[DirMenu]
menu1=-Doc
menu2=usr
cmd2=cd c:\usr
menu3=--

Image: https://github.com/Daedemons/hello-world/blob/master/image.png
User avatar
Dalai
Power Member
Power Member
Posts: 9945
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: cannot wrtie user.ini

Post by *Dalai »

Can you edit user.ini with other programs?
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
FForever
Junior Member
Junior Member
Posts: 6
Joined: 2024-07-26, 08:35 UTC

Re: cannot wrtie user.ini

Post by *FForever »

Dalai wrote: 2024-07-26, 10:22 UTC Can you edit user.ini with other programs?
Yes, i can edit it with any editors include nodepad. Actually, it happens on my another computer. Can you please try to repeat my action in your computer? I don't know if this is a problem with my device, thx.
User avatar
beb
Power Member
Power Member
Posts: 579
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: cannot wrtie user.ini

Post by *beb »

2FForever
Please, make sure your wincmd.ini and redirected ini in question have a valid encoding.
Only two options are available (supported by Windows ini functions): ANSI and/or UTF-16LE with BOM (1200).
E.g., if your ini saved in UTF-8 (65001), resave it in UTF-16LE with BOM (1200).
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cannot wrtie user.ini

Post by *ghisler(Author) »

If you have installed Total Commander under "Program Files", %COMMANDER_PATH% would point there too. All subfolders are write protected by default. You can press Alt+Enter on the file and grant yourself full access to the file if you want to modify it with normal user rights.
Author of Total Commander
https://www.ghisler.com
FForever
Junior Member
Junior Member
Posts: 6
Joined: 2024-07-26, 08:35 UTC

Re: cannot wrtie user.ini

Post by *FForever »

beb wrote: 2024-07-26, 13:07 UTC 2FForever
Please, make sure your wincmd.ini and redirected ini in question have a valid encoding.
Only two options are available (supported by Windows ini functions): ANSI and/or UTF-16LE with BOM (1200).
E.g., if your ini saved in UTF-8 (65001), resave it in UTF-16LE with BOM (1200).
The format of both files is UTF-16LE with BOM. As what i said, the redirected ini can be writed with correct imformation, and it will pop up an error dialog at the same time. After i close the dialog, i can find the redirected ini has been writed with correct imformation.
FForever
Junior Member
Junior Member
Posts: 6
Joined: 2024-07-26, 08:35 UTC

Re: cannot wrtie user.ini

Post by *FForever »

ghisler(Author) wrote: 2024-07-26, 13:15 UTC If you have installed Total Commander under "Program Files", %COMMANDER_PATH% would point there too. All subfolders are write protected by default. You can press Alt+Enter on the file and grant yourself full access to the file if you want to modify it with normal user rights.
I installed tc in portable mode, and i comfirm that i have enough right to edit this ini file, not read only. Even i start tc with administrator mode, it pop up the error dialog.
User avatar
white
Power Member
Power Member
Posts: 5747
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: cannot wrtie user.ini

Post by *white »

FForever wrote: 2024-07-26, 13:20 UTC The format of both files is UTF-16LE with BOM.
Confirmed when using that encoding. Also without redirection. Also, when adding not to subfolder and then deleting it.
User avatar
white
Power Member
Power Member
Posts: 5747
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: cannot wrtie user.ini

Post by *white »

It is caused by this change in TC 11.00rc2:
14.07.23 Fixed: Directory hotlist, add entry in submenu or delete entry: Write entire section [dirmenu] to store it in sorted order and much faster, warn if section too big (32/64)

Moderator message from: white » 2024-07-26, 14:08 UTC

Moved topic
» from Total Commander (English) to TC11.x bug reports (English)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cannot wrtie user.ini

Post by *ghisler(Author) »

I cannot reproduce this. Here is what I tried:
1. Installed in C:\Program Files\Total Commander\ (write protected)
2. Added the following to wincmd.ini:
[DirMenu]
RedirectSection=%COMMANDER_PATH%\User\User.ini
3. Created directory User under the program directory (as administrator)
4. Tried to save directory to hotlist -> error as expected
5. Copied a file User.ini (encoded as UTF16LE) with some entries to User dir
6. Tried to save directory to hotlist -> still error as expected
7. Alt+Enter on User.ini, grant "User" full access to file
8. Tried to save directory to hotlist -> no more error, the file is saved
9. Deleted User.ini
10. Alt+Enter on directory "User", grant "User" full access to file
11. Copied a file User.ini (encoded as UTF16LE) with some entries to User dir
12. Tried to save directory to hotlist -> no more error, the file is saved

I tried this with wincmd.ini located under c:\users\... (writable) and also under c:\Program Files\... (not writable).
So at least here it works when the user has the right to either write to "User.ini" or to the directory "User".
What am I missing?
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5747
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: cannot wrtie user.ini

Post by *white »

ghisler(Author) wrote: 2024-07-31, 07:01 UTC ...
8. Tried to save directory to hotlist -> no more error, the file is saved
...
12. Tried to save directory to hotlist -> no more error, the file is saved
...
What am I missing?
It's not about simply saving, but explicitly saving an entry to a subfolder in the directory hotlist. Or deleting an entry.
It's about a specific error being displayed, the file is saved regardless of that. In what circumstance this error "-> <filename>" (starting with an ascii arrow) is displayed, should be easy to find in your code.
It is not specifically related to redirection. Simply unpack the TC installer to a folder, create a wincmd.ini with UTF-16 LE BOM encoding with contents

Code: Select all

[Configuration]
UseIniInProgramDir=7
Then start TC, add current folder to directory hotlist, remove current folder from directory hotlist.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cannot wrtie user.ini

Post by *ghisler(Author) »

saving an entry to a subfolder in the directory hotlist. Or deleting an entry.
Thanks, I missed that. I can reproduce it now. In the branch dealing with the Unicode ini file there was a result:=true missing.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cannot wrtie user.ini

Post by *ghisler(Author) »

This should be fixed in Total Commander 11.50 beta 1, please check it!
01.08.24 Fixed: Ctrl+D directory menu: An error was shown when adding item to subfolder or removing item, but only when [dirmenu] section redirected to Unicode ini file (32/64)
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5747
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: cannot wrtie user.ini

Post by *white »

ghisler(Author) wrote: 2024-10-09, 14:12 UTC This should be fixed in Total Commander 11.50 beta 1, please check it!
01.08.24 Fixed: Ctrl+D directory menu: An error was shown when adding item to subfolder or removing item, but only when [dirmenu] section redirected to Unicode ini file (32/64)
As I said, it is not specifically related to redirection:
white wrote: 2024-07-31, 07:34 UTC It is not specifically related to redirection. Simply unpack the TC installer to a folder, create a wincmd.ini with UTF-16 LE BOM encoding with contents
So I think your bug fix description should read:
01.08.24 Fixed: Ctrl+D directory menu: An error was shown when adding an item to a subfolder or removing an item, but only when the [dirmenu] section was written to an ini file with Unicode encoding (UTF-16 LE BOM) (32/64)
(Made it less broken English as well.)

Tested OK, but I did not test it with redirection.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cannot wrtie user.ini

Post by *ghisler(Author) »

Thanks for confirming the fix! I will use your description for the history.
As I said, it is not specifically related to redirection:
The original post was using RedirectSection to point to a Unicode ini file. I didn't test with a Unicode main ini file.
Author of Total Commander
https://www.ghisler.com
Post Reply