On 2015-06-08, Uwe Stöhr wrote:
> Am 04.06.2015 um 23:31 schrieb Guenter Milde:

>> Do you really need a full path to the binary on Windows?

> Yes.

OK.

>> Please keep the current distinction of

>>    program call  (ac_prog)
>>    program name  (ac_word)
>>    path              (path)

>> even if "inkscape" is not on the binary PATH. Then, there is no need to
>> have \s and \\" in program names.

> I need a way to handle the space characters in the path of the binary. 

> The problem with the current code is this line:

> ac_word = ac_prog.split(' ')[0]

Not, if you separate path and program call, e.g.

   (path, ac_prog) = os.path.split("path to\binary of\inkscape --help")
   
would result in:

>>    program call  ac_prog = "inkscape --help"
>>    path          path = "path to\binary of"
   
(`os.path.split` returns a tuple "(head, tail)" where "tail" is
everything after the final slash.)

> With my patch I tried to keep a much of the checkProg routine as 
> possible. If you have a better idea please tell me.

Maybe the main idea was a bit obscured:

>> Instead, getInkscapeBinary() may be renamed to getInkscapePath() and

now comes the important part:

>> then call checkViewerEditor with the "path" argument

>>      (inkscape_path, inkscape_name) = os.path.split(getInkscapePath())
>>      checkViewerEditor('a SVG viewer and editor', [inkscape_name],

However, you quoted only the first part of my suggestion. The complete
function call includes the path to inkscape as last, named argument:

    (inkscape_path, inkscape_name) = os.path.split(getInkscapePath())
    checkViewerEditor('a SVG viewer and editor', [inkscape_name],
        rc_entry = [r'\Format svg        svg     SVG                    "" "%%"
        path = [inkscape_path])


I did not check, whether the checkViewerEditor() and related functions
already care for spaces in the path, but even if not (yet), fixing this
would be much easier, as 

  ac_word = ac_prog.split(' ')[0]
  
works on `ac_prog`, which does not have other spaces (the spaces are in
`path`).

Günter

Reply via email to