Passing long filenames to editor (F4)

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Wisdom
Junior Member
Junior Member
Posts: 5
Joined: 2003-12-06, 18:02 UTC

Passing long filenames to editor (F4)

Post by *Wisdom »

Hello,

It seems that TC passes short filenames to the editor configured for F4. (i.e. "C:\Program Files\Totalcmd\wincmd.ini" passed as "C:\Progra~1\Totalcmd\wincmd.ini"). While this works perfectly ok under Windows, it is sometimes desirable to have long filename passed in its exact form to the editor (i.e. under Unix with Wine). Is there a way to achieve this with the current version of TC?

Thanks for any help/comments.
User avatar
Wilhelm M.
Power Member
Power Member
Posts: 996
Joined: 2003-06-05, 10:45 UTC

Post by *Wilhelm M. »

Have you set "Use long names" in Configuration/Options/Display ?
Grüße/Regards,
Wilhelm
Wisdom
Junior Member
Junior Member
Posts: 5
Joined: 2003-12-06, 18:02 UTC

Post by *Wisdom »

Yes, but it affects only panel-display, unfortunately.
User avatar
Wilhelm M.
Power Member
Power Member
Posts: 996
Joined: 2003-06-05, 10:45 UTC

Post by *Wilhelm M. »

Not on my system, W2K. Long filenames are used in the display as well as in the strings passed to the editor.

You could also (tentatively) call the editor from a button and pass the filename via %P%N.
Grüße/Regards,
Wilhelm
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3300
Joined: 2003-05-06, 11:46 UTC

Re: Passing long filenames to editor (F4)

Post by *Sir_SiLvA »

Wisdom wrote:It seems that TC passes short filenames to the editor configured for F4. (i.e. "C:\Program Files\Totalcmd\wincmd.ini" passed as "C:\Progra~1\Totalcmd\wincmd.ini").
Cant Confirm this for Win Xp SP2....
Hoecker sie sind raus!
Wisdom
Junior Member
Junior Member
Posts: 5
Joined: 2003-12-06, 18:02 UTC

Post by *Wisdom »

Ok, it seems like a Wine related issue. Thanks for your feedback, guys.

Here is how I "solved" it for now:

I created a small shell script:
#!/bin/sh
emacs `echo $1 | sed 's/U://' | tr '\\\' '/'`

("U:" is the drive that Wine maps to my root (/) filesystem. And "emacs" is obviously my editor of choice.)

I saved that script as:
/home/wisdom/bin/tcedit.sh

I made it executable with:
chmod +x /home/wisdom/bin/tcedit.sh

In TC, I created a button for that script, using "%P%N" as parameters. (Thanks Wilhelm.)

Dragging a file to that button now opens up Emacs as expected.

Just a quick and dirty hack. Please let me know if there is a more decent solution to this. Thanks.
Wisdom
Junior Member
Junior Member
Posts: 5
Joined: 2003-12-06, 18:02 UTC

Post by *Wisdom »

Ok, I just found a decent solution to this problem.

Command-line tool winepath (which comes with Wine package) does the necessary conversion.

So, if you modify the script from my previous post as the following;

#!/bin/sh
emacs `winepath -u "$*"`

and then just define that script as the editor for F4 (i.e. U:\home\wisdom\bin\tcedit.sh, where U: would be a Wine drive mapping to your root (/) filesystem.), it just works. :-)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48096
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2Wisdom

TC passes short names to the editor if it either cannot check the editor .exe type, or it is a 16-bit program. But there is a workaround: Set the following as the editor command line:

editorname "%1"

The double quotes are important! They tell TC to use long names.
Author of Total Commander
https://www.ghisler.com
User avatar
bdk
Junior Member
Junior Member
Posts: 34
Joined: 2006-11-24, 09:32 UTC

Same problem?

Post by *bdk »

Hi

If I use Ultraedit as editor under F4 I run into trouble which I think is related to this the problems discussed in this thread.

The problem occurs when I try to use F4 from inside an archive. TC then asks "Do you want to extract the file and edit it". I confirm and UE is opened with the file. The path to the file in UE is to TC's temporary directory (something like 'C:\DOCUME~1\t716207\LOCALS~1\Temp\_tc_\filename'). Is this related to the long/short name problem?
Everything looks fine. But the problem is that after a few seconds UE tells me that the original file is removed from the disk, and I get an option to save the file under a new name. I guess what happens is that TC deletes the temporary file.

But the strange thin is that if I choose to use Notepad as the editor for F4, everything works. When inside an archive, F4 brings up the "do you want to extract and edit"-dialog. The file opens in Notepad, I edit the file, save and close. TC then asks me if I want to update the archive with the edited file. Everything is just fine.

But I really, really want to be able to use UE as my editor for such operations. I tried to do the "%1"-trick, but it did not work.

Am I missing something here?

Thanks in advance.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48096
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

TC apparently thinks that the editor closes, and immediately deletes the temporary files. This happens with some editors which have a launcher, e.g. uedit.exe launching the actual editor ultraedit.exe (that's just an example, I don't know whether this really happens here or not), or when you use a multiple document interface and the editor is already running.

Normally TC then shows a dialog box which asks the user to press a button when the editor has been closed. This function will not work if
1. you have an old TC version, or
2. disabled this feature via the ini, or
3. the editor takes several seconds to start.
Author of Total Commander
https://www.ghisler.com
User avatar
bdk
Junior Member
Junior Member
Posts: 34
Joined: 2006-11-24, 09:32 UTC

Thanx

Post by *bdk »

Hi

Thanks for the post, Mr. Ghisler. :-) The problem was that I only allow UE to run one instance. If I allow UE to run multiple instances, the file opened from TC will open in a new instence of UE. I can the edit the file, save and close and TC then asks me if I want to repack the file and everything is just fine.

But which feature do you talk about in your post under 2.? And which dialog box are you referring to?
I just want to do some more testing, since I really do not want to have new instances of UE every time I open a file from TC.
User avatar
petermad
Power Member
Power Member
Posts: 14814
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

2bdk
But which feature do you talk about in your post under 2.?
From the Help file section 4b (wincmd.ini):
EditWaitTime=2 Timeout value when editing files from an archive or ftp server: If an editor closes within this amount of seconds, assume that it's a multiple document editor and show dialog where user can confirm when editing has ended.
Set to 0 to turn off this feature.
Set to -1 to not show this dialog at all (e.g. when the file was passed via DDE to the associated program).
And which dialog box are you referring to
http://madsenworld.dk/tcmd/closetemp.png
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
bdk
Junior Member
Junior Member
Posts: 34
Joined: 2006-11-24, 09:32 UTC

Problem solved!!

Post by *bdk »

Thanx for the post. Now I finally got things working the way I wanted.
Setting EditWaitTime to something else than -1 did the trick.

Now TC and UE are working hand in hand like a charm.
saugx
Junior Member
Junior Member
Posts: 5
Joined: 2008-10-15, 12:39 UTC

Post by *saugx »

if you are using a mac and also want to be able to use f4 as an editor with a native editor and CrossOver you can do as follows:
- create a shell script as Wisdom does
- paste the following:

Code: Select all

#!/bin/bash

FILE=`/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/bin/wine --wl-app /Applications/CrossOver.app/Contents/SharedSupport/CrossOver/lib/wine/winepath.exe.so -u $1`
/usr/bin/mate "$FILE"
- note that the command is all in one line
- i am using textmate but you can of course use any editor
- call your script with "%1" as christian posted earlier

cheers,
alex
Post Reply