[TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

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

Moderators: white, Hacker, petermad, Stefan2

p.tingen
Junior Member
Junior Member
Posts: 22
Joined: 2007-09-25, 05:52 UTC
Location: Netherlands

[TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *p.tingen »

For F4 (edit file under cursor) I use Choice Editor to start the correct program when editing.

When I try to edit the file "c:\temp\log\agv.20230512.log" in notepad++ I get this error: Cannot open file "c:\temp\log\܁".
Image: https://i.imgur.com/AfAJek0.png

Reverted back to beta 6 and there it works.

Choice editor uses a config file that looks like this:

Code: Select all

DisplayName1=Notepad++
Editor1=c:\Program Files (x86)\Notepad++\notepad++.exe
Ext1=LOG,T,P,W,I,TXT
I assume it calls the program specified by "Editor1" with the currently selected file as parameter.
No matter the extension of the file, it will always try to open Notepad++ with similar errors.
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *AntonyD »

"c:\temp\..."? temp - really? Maybe you are trying to edit some file from some archive?
Because If I will create the file like yours = "c:\temp\log\agv.20230512.log" - and will try to open it in Editor by F4 - I will get it properly opened in my editor.
#146217 personal license
User avatar
MaxX
Power Member
Power Member
Posts: 1029
Joined: 2012-03-23, 18:15 UTC
Location: UA

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *MaxX »

Does it work without Choice Editor ?
Ukrainian Total Commander Translator. Feedback and discuss.
User avatar
I-Vladimir
Junior Member
Junior Member
Posts: 29
Joined: 2012-09-26, 15:18 UTC

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *I-Vladimir »

I have the same issue viewing files with F3.
I have a config line in extensions:
cs=C:\Program Files (x86)\Notepad++\notepad++.exe -x700 -y200 ^.cs
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *AntonyD »

2I-Vladimir
same question and to you - Does it work without Choice Editor ?
#146217 personal license
User avatar
beb
Senior Member
Senior Member
Posts: 435
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *beb »

Got a similar issue since TC 11 beta7 with a dedicated text editor [without Choice Editor]:

User case:
F4 editor settings: AkelPad, a relative path to the AkelPad.exe:

Code: Select all

[Configuration]
Editor=Plugins\app\AkelPad\AkelPad.exe
Issue: AkelPad cannot open file(s) with a message similar to the one in the title.

Workarounds found:

[1] F4 editor settings: Same as above with input parameter "%1" added:

Code: Select all

Editor=Plugins\app\AkelPad\AkelPad.exe "%1"
Issues: None. Not affected. AkelPad works as intended.

[2] F4 editor settings: absolute path to the exe (either literal or with variable):

Code: Select all

Editor=l:\iteral\TC\Plugins\app\AkelPad\AkelPad.exe
Editor=%commander_path%\Plugins\app\AkelPad\AkelPad.exe
Issues: None. Not affected. AkelPad works as intended.

Other editors: notepad.exe; notepad++.exe (I always rename it as npp.exe):
F4 editor settings: any way to set a path to the exe (either relative, literal, or with variable)

Code: Select all

Editor=notepad.exe
Editor=Plugins\app\Npp\npp.exe
Editor=l:\iteral\TC\Plugins\app\Npp\npp.exe
Editor=%commander_path%\Plugins\app\Npp\npp.exe
Issues: None. Not affected. Everything works as intended.

Conclusion:
Explicitly, something has been changed in this regard in TC 11 beta7 that in certain cases can provoke unusual behavior where things have been working for years with no issues.


Edit:

Out of curiosity, if I change the custom npp.exe name back to the standard one (notepad++.exe), it becomes affected exactly in the same way as AkrelPad does:

Affected:

Code: Select all

Editor=Plugins\app\Npp\notepad++.exe
Not affected:

Code: Select all

Editor=Plugins\app\Npp\notepad++.exe "%1"
Editor=l:\iteral\TC\Plugins\app\Npp\notepad++.exe
Editor=%commander_path%\Plugins\app\Npp\notepad++.exe
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10
batchman61
Junior Member
Junior Member
Posts: 43
Joined: 2003-02-07, 19:24 UTC
Location: Germany

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *batchman61 »

Similar issue here with External viewer.

Configuration, Edit/View, External viewer : %PORTABLE_IVIEWPATH% %1
(PORTABLE_IVIEWPATH is set in launch script for TC).
For years without issues up to 11.00b6.
With 11.00b7 error like Cannot open D:\tmp\~*á when trying to "external view" D:\tmp\test.png.

Found that removing %1 from External viewer configuration (%PORTABLE_IVIEWPATH%) works ok for b7, and b6.
Maybe related to environment variable handling ?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *ghisler(Author) »

I can reproduce the problem. Please replace %1 with "%1" when this occurs, or append "%1" yourself.
Total Commander otherwise tries to append the short DOS name when it cannot determine whether the program is 32-bit or 64-bit.
Since 64-bit Windows cannot run 16.bit code anyway, I will remove this check on 64-bit systems.
Author of Total Commander
https://www.ghisler.com
User avatar
I-Vladimir
Junior Member
Junior Member
Posts: 29
Joined: 2012-09-26, 15:18 UTC

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *I-Vladimir »

But I have this issue with F3 having executables defined for extensions
I have multiple extension definitions and they do not work both and with no quotes in file name.
bat=C:\Program Files (x86)\Notepad++\notepad++.exe -x700 -y200 ^.bat

F4 works with notepad++.
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *AntonyD »

2ghisler(Author)
btw - do we MUST append "%1" when we set-up ext.Viewer and Editor paths?
Or TC can(will?) do that by itself when it calls a proper exe?
#146217 personal license
User avatar
petermad
Power Member
Power Member
Posts: 14810
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *petermad »

2AntonyD
Or TC can(will?) do that by itself when it calls a proper exe?
If you use the [>>] button next to the Editor field in the setup to select the editor, then TC adds "%1" automatically.

But if you fill out the field manually it is up to you to add "%1".

It is not all editors that need "%1"
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *AntonyD »

2petermad
Wait - what exactly do we mean by this substitution pattern?
IMHO "%1" is a placeholder that represents the file path of the selected file.
AND ONLY one file. So by logic - we SHOULD not enter this placeholder - coz TC will prepare the full command line
AND w/o it. Line will look like that: DISK:\path_to_my_exe_file\file.exe full_path_to_selected_file
This pattern will then be an excessively unnecessary thing in itself if we bring it into the editbox.
After all, then TC itself will have to somehow "digest" the fact of its presence on the way and appropriately replace it with the desired value?
And if I mistakenly enter "%2"/3/4... - what happens?
#146217 personal license
User avatar
petermad
Power Member
Power Member
Posts: 14810
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *petermad »

This pattern will then be an excessively unnecessary thing in itself if we bring it into the editbox.
TC already does add "%1" if you choose the editor via the [>>] button.
history.txt wrote:02.12.12 Fixed: When choosing an editor for F4 or viewer for Alt+F3 via ">>" button, surround with "" if path contains spaces, and append "%1"

09.05.08 Fixed: F4 edit of files in archives -> TC always passed the short DOS name to the editor. Now the long name will be passed if the editor is recognized as 32-bit, or "%1" with double quotes is given as parameter

26.02.98 Added: Allow parameter %1 or "%1" in editor/default viewer configuration field, e.g. notepad.exe "%1"
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
AntonyD
Power Member
Power Member
Posts: 1249
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *AntonyD »

2petermad
I reasoned about the purely manual entry of the path to the desired program by the user.
In this case, perhaps it is necessary to somehow control this input?
To get only the string construction that Total supports when called "file.exe selected_file".
That is, for this, insert a hint-label at the bottom of editbox, that when manually inserting the path -
Do NOT forget to add "%1" at the end of your input, but it's better if you use directly the button [>>] next to the input field.
Last edited by AntonyD on 2023-06-19, 07:43 UTC, edited 1 time in total.
#146217 personal license
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48093
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.00b7] Edit file via F4 and Choice Editor: notepad++ shows "Cannot open c:\temp\܁"

Post by *ghisler(Author) »

It's a bug, you only need to add "%1" if you encounter the problem with beta 7. It will be fixed in beta 8.
Author of Total Commander
https://www.ghisler.com
Post Reply