Create file and open with Notepad++ fails

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

SalmaTheBest
New Member
New Member
Posts: 1
Joined: 2023-08-01, 23:04 UTC

Create file and open with Notepad++ fails

Post by *SalmaTheBest »

Hello. I use totalcmd 11 (just updated) and here is the problem:
If I create a file without extensions then it is failed to open as the dot added to the end of path.

For example I create file (Shoft+F4) "C:\123321" and then notepad is called like "C:\Program Files\Notepad++\notepad++.exe" "%1", it says "Cannot open file "c:\123321." <--- dot is added to the end of path.

This problem exists in 10.52 which I was using till now, was hoping that v11 has this issue fixed.
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3299
Joined: 2003-05-06, 11:46 UTC

Re: Create file and open fails

Post by *Sir_SiLvA »

This is a known notepad++ bug NOT a TC bug.
(Search the forum for more infos)
Hoecker sie sind raus!
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: Create file and open fails

Post by *JOUBE »

This is a Tc bug. The bug is the wrong decision to simply append a dot to such a file name beyond the user. (Please search the forum for the reasons for this decision.) If one can understand the reasons for this decision by ghisler(author), so it is at least a bug not to let the user choose (via an ini switch) whether he wants the attached dot or not. But simply adding a dot does not respect the user. Not letting the users decide this is a bug and should be corrected before the release of Tc11.

Joube
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file and open with Notepad++ fails

Post by *ghisler(Author) »

The reason is that most versions of notepad.exe will try to open "filename.txt" instead of "filename" when just passing the name without dot at the end. Normally Windows does NOT allow to create files with a dot at the end, you need to use a special hack to access them at all. If you just pass "c:\path\filename." to the Windows functions, they will access "c:\path\filename" instead.

I will add a workaround when the path to the editor contain notepad++.exe. It will not work when you replace the actual executable notepad.exe with notepad++.exe or use something like choice editor, because then I cannot know that notepad++ will be called in the end.
Author of Total Commander
https://www.ghisler.com
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6496
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Create file and open with Notepad++ fails

Post by *Horst.Epp »

I would not add a special hack to circumvent this error in Notepad++.
All other editors I tried work correct for this case.
User which insists to Notepad++ can still change the file name after editing.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
TC 11.03 x64 / x86
Everything 1.5.0.1373a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file and open with Notepad++ fails

Post by *white »

It's a regression bug in Notepad++ and a fix is already committed. It should be fixed when the next version (8.5.5) is released.
User avatar
Stefan2
Power Member
Power Member
Posts: 4159
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Create file and open with Notepad++ fails

Post by *Stefan2 »

ghisler(Author) wrote: 2023-08-02, 07:25 UTC The reason is that most versions of notepad.exe will try to open "filename.txt" instead of "filename"

I will add a workaround when the path to the editor contain notepad++.exe.

How about adding your trailing dot then only when the path to the editor (set by user or the default) contain "notepad.exe" ?


And ini-entries to let the user control such hacks are always welcome ;-)

 
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: Create file and open with Notepad++ fails

Post by *JOUBE »

ghisler(Author) wrote: 2023-08-02, 07:25 UTC The reason is that most versions of notepad.exe will try to open "filename.txt" instead of "filename" when just passing the name without dot at the end. Normally Windows does NOT allow to create files with a dot at the end, you need to use a special hack to access them at all. If you just pass "c:\path\filename." to the Windows functions, they will access "c:\path\filename" instead.
Everybody, who have posted in this thread, know that.
ghisler(Author) wrote: 2023-08-02, 07:25 UTC I will add a workaround when the path to the editor contain notepad++.exe. It will not work when you replace the actual executable notepad.exe with notepad++.exe or use something like choice editor, because then I cannot know that notepad++ will be called in the end.
Please do not supplement a bad automatism with another bad automatism. You ghisler(author) had received the wrong advice on this matter and got involved. Please rebuild this. Instead of putting another on it....

notepad++ works fine and correct (without any changes). So Tc had to make a special switch for all the editors out there, who wants to append .txt if not extension is handed over by the TC. No automatism. a configurable switch.

Joube
Last edited by JOUBE on 2023-08-02, 09:23 UTC, edited 2 times in total.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file and open with Notepad++ fails

Post by *ghisler(Author) »

How about adding your trailing dot then only when the path to the editor (set by user or the default) contain "notepad.exe" ?
That would break other editors. For example, I'm using OpenFileTC.exe, which then launches notepad.exe for some file types. There are other similar tools:
Total Commander Edit Redirector
ChoiceEditor
ChooseEditor
Since only notepad++ is affected, it's better to just exclude it for that.
notepad++ works fine and correct (without any changes).
No it doesn't. Why would they announce a patch if it does?
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: Create file and open with Notepad++ fails

Post by *JOUBE »

ghisler(Author) wrote: 2023-08-02, 09:23 UTC[Why would they announce a patch if it does?
Why? it is easy: It takes half a year before the author of notepad++.exe understand tc-forum-user 'white*s suggestion. After that, he told, he will implement this special feature, but after that, he releases a new version without a change at this point. So, to be clear, if Tc wants to speak with notepad++.exe, Tc has to handle it. And is able to do that very easy: by automatism, if there is no other way before the release of TC11.

Joube
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file and open with Notepad++ fails

Post by *white »

JOUBE wrote: 2023-08-02, 09:28 UTC Why? it is easy: It takes half a year before the author of notepad++.exe understand tc-forum-user 'white*s suggestion. After that, he told, he will implement this special feature, but after that, he releases a new version without a change at this point.
You didn't respond to my question in another thread where I asked what version you are talking about:
white wrote: 2023-07-18, 19:47 UTC
JOUBE wrote: 2023-07-18, 19:21 UTC New update of npp yesterday and: it isn't fixed.
New update? Where can I find it? The latest version I see is version 8.5.4.
JOUBE wrote: 2023-07-18, 19:21 UTC Not very successful there your attempt...
I reported the bug, but it isn't my fix. If I understand it correctly the fix was committed 3 days ago, but I don't see a new version yet. So, no idea if the fix works.
You say that there was an update of Notepad++ on July 17, 2023, but according to the website the latest version is 8.5.4 released on June 18, 2023. Please explain.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file and open with Notepad++ fails

Post by *ghisler(Author) »

2white
I have added this fix to Total Commander 11 now. Could you please check the pre-release version which I sent you via e-mail? That would help me a lot because there will be no more beta versions before the final release.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file and open with Notepad++ fails

Post by *white »

ghisler(Author) wrote: 2023-08-02, 11:27 UTC 2white
I have added this fix to Total Commander 11 now. Could you please check the pre-release version which I sent you via e-mail?
I tested TC 32-bit and 64-bit with Notepad++ 64-bit. It works as long as you use full path to the editor including ".exe".

It does not work when:
  • You leave out ".exe"
  • You leave out the path and the path is in the path environment variable
  • You leave out the path and the full path is stored in the registry key
    "HKEY_LM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\notepad++.exe"
    (recent Notepad++ installers do that)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file and open with Notepad++ fails

Post by *ghisler(Author) »

Yes, I'm aware of that. Since it's a workaround, I wanted to make it as restrictive as possible.
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: Create file and open with Notepad++ fails

Post by *JOUBE »

ghisler(Author) wrote: 2023-08-02, 12:59 UTC Yes, I'm aware of that. Since it's a workaround, I wanted to make it as restrictive as possible.
It should also be possible with this pathname: "C:\Program Files (x86)\Npp\notepad++.exe". Does it?

And in the 11 a should not only stay with the workaround, if possible.

The thread at notepad++ is pretty embarrassing overall. Denouncing a bug, it's the Tc itself manipulating user input.

2white
Incidentally, I simply installed the update that was automatically offered to me in notepad++ on that day mentioned. I use notepad++ every day. It was tow days after that post in that thread at notepad++.

Joube
Post Reply