Loading ...
Sorry, an error occurred while loading the content.

47352Re: globpath() doesn't like paths ending with \.

Expand Messages
  • Jonathan D Johnston
    Feb 1, 2004
    • 0 Attachment
      On Fri, 30 Jan 2004 23:52:30 -0800,
      "Suresh Govindachar" <sgovindachar@...> wrote:
      > Hello,
      >
      > Some of the directories in my windows path end with \ and
      > globpath() cannot find files in these directories. I found
      > this out by executing the following commands. (Although the
      > two commands below are written in multiple lines, they are
      > actually one line commands.)
      >
      > haveit.exe is not found by the next command:
      >
      > :let foo=substitute($path, ";", ",", "g") |
      > let foo=globpath(foo, "haveit.exe") | echo(foo)
      >
      > but is found by the following command:
      >
      > :let foo=substitute($path, ";", ",", "g") |
      > let foo=substitute(foo, "\\\\,", ",", "g") |
      > let foo=globpath(foo, "haveit.exe") | echo(foo)
      >
      > Seems odd that things are this way with globpath().
      >
      > --Suresh

      Hi Suresh,

      The backslash (\) is escaping the following comma (,).

      For example, if I create two directories "I:\x\test" & "I:\x\this,that"
      & drop a "nonesuch" file in each:

      :echo globpath('I:/x/test,I:/x/this\,that','nonesuch')

      displays:

      I:\x\test\nonesuch
      I:\x\this,that\nonesuch

      To do that (rather pathological :-) test, I needed to be able to give
      globpath() the directory "I:\x\this,that" without it being interpreted
      as "I:\x\this" & "that". Backslash is used, as usual, to escape the
      separator meaning of the comma. So, for me, the behavior of globpath()
      is very reasonable.

      Shame on M$ for picking \ as the separator in filename paths.
      Fortunately, Vim can use / on DOS & Windows. For your original example,
      I would s/;/,/g and s#\\#/#g .

      HTH,
      Jonathan D Johnston

      ________________________________________________________________
      The best thing to hit the Internet in years - Juno SpeedBand!
      Surf the Web up to FIVE TIMES FASTER!
      Only $14.95/ month - visit www.juno.com to sign up today!
    • Show all 6 messages in this topic