Inconsistent file quoting in main window vs search results

Bugs and issues - current donor version.
Post Reply
Message
Author
catweazle9
Posts: 22
Joined: 30.03.2009, 08:37

Inconsistent file quoting in main window vs search results

#1 Post by catweazle9 » 14.08.2014, 20:51

[using FreeCommander XE build 665 public beta]

In the Settings I've configured an editor as follows:
Program: C:\emacs\bin\emacsclientw.exe
Parameters: -n %ActiveItem%

When I select a file in FreeCommand and press F4 to invoke the editor, the selected file is passed to the editor as expected. If the file name contains spaces, it needs to be quoted so I add double quotes around the %ActiveItem%, as follows:
Parameters: -n "%ActiveItem%"

This fixes this particular problem. Using procmon (from sysinternals) I can see the process is started as expected with:
Command line: "C:\emacs\bin\emacsclientw.exe" -n "a b.txt"

However, if I select a file in the search results and press F4, the full path to the file is specified on the command line BUT a second set of double quotes are added around the file argument, so that the process is started as follows:
Command line: "C:\emacs\bin\emacsclientw.exe" -n ""C:\Users\John\Dropbox\a b.txt""

This second set of double quotes corrupts the command line and the file fails to load in the editor. I can work around this by removing the double quotes around %ActiveItem% in the Settings, but then this breaks file loading in the main FreeCommander window.

Can this easily be fixed, so that parameters are quoted consistently when F4 is pressed, either in the main window or in the search results window?

Thanks,

--- John.

catweazle9
Posts: 22
Joined: 30.03.2009, 08:37

Re: Inconsistent file quoting in main window vs search resul

#2 Post by catweazle9 » 22.09.2014, 11:09

In case others run into the same problem, the following short program (C#, built as a Windows app) can be used as a work around. After compiling, I register it with FreeCommander as the program to be invoked when pressing F4. The program fixes up any inconsistency in the arg list prior to invoking emacsclientw.exe, so it now works properly when I press F4 from one of the main panes and also when I press F4 on an item in the search results.

Code: Select all

using System;
using System.Diagnostics;

namespace RunFromFC
{
    static class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            //Debugger.Launch();
            if (args == null || args.Length == 0)
                return;

            string filename = (args.Length == 1) ? args[0] : string.Join(" ", args);
            if (filename[0] != '"')
                filename = string.Format("\"{0}\"", filename);

            Process.Start(@"C:\emacs\bin\emacsclientw.exe", string.Format("-n {0}", filename));
        }
    }
}

joby_toss
Posts: 1346
Joined: 22.07.2009, 19:19
Location: Romania
Contact:

Re: Inconsistent file quoting in main window vs search resul

#3 Post by joby_toss » 22.09.2014, 11:57

A fix was introduced starting with build 669 (donor version for now, but will be included for sure in the next public release).

Post Reply

Who is online

Users browsing this forum: No registered users and 67 guests