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

[BUG] VIM7: "gvim --remote-silent d:\a[1]\a.txt" goes wrong

Expand Messages
  • Liu Yubao
    cd d: a[1] or any other sub directory of d: a[1] gvim --remote-silent d: a[1] aa.txt it reports: E344: Can t find directory d:/a/[1]/a
    Message 1 of 1 , May 29, 2006
    • 0 Attachment
      cd d:\a[1] " or any other sub directory of d:\a[1]
      gvim --remote-silent d:\a[1]\aa.txt
      it reports:
      E344: Can't find directory "d:/a/[1]/a" in cdpath
      E472: Command failed

      I found this bug in VIM7.0b and VIM7.0c03, someone reported
      this also existed in VIM7.0 final version.

      It seems this code snippet is not right (VIM7.0c03):
      3537 if (mch_dirname(cwd, MAXPATHL) != OK)
      3538 return NULL;
      3539 if ((p = vim_strsave_escaped_ext(cwd, PATH_ESC_CHARS, '\\',
      TRUE)) == NULL)
      3540 return NULL;
      3541 ga_init2(&ga, 1, 100);
      3542 ga_concat(&ga, (char_u *)"<C-\\><C-N>:cd ");
      3543 ga_concat(&ga, p);
      3544 vim_free(p);

      mch_dirname() returns "d:\a[1]", vim_strsave_escaped_ext() returns
      "d:\a\[1]" (I don't know why '[' is contained in PATH_ESC_CHARS),
      so we get a ":cd d:\a\[1]" command with ga_concat() in line 3543.
      At last, misc2.c:5384:find_file_in_path_option() reports the error above.

      I'm not familiar with the code, so I hope someone can give a perfect patch:-)
    Your message has been successfully submitted and would be delivered to recipients shortly.