Page 1 of 1

Inconsistent file quoting in main window vs search results

Posted: 14.08.2014, 20:51
by catweazle9
[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?


--- John.

Re: Inconsistent file quoting in main window vs search resul

Posted: 22.09.2014, 11:09
by catweazle9
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
        static void Main(string[] args)
            if (args == null || args.Length == 0)

            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));

Re: Inconsistent file quoting in main window vs search resul

Posted: 22.09.2014, 11:57
by joby_toss
A fix was introduced starting with build 669 (donor version for now, but will be included for sure in the next public release).