Thanks for the resolve() lead.

For the record, It turns out that resolve() resolves symlinks but does
not make them absolute.
For example if if path1== "/home/joe" and path2 == "." and current dir
is "/home/joe",
expression (resolve(path1) == resolve(path2)) is  false.

The following does the trick for me:

func! ResolveAndMakeAbsolute(path)
    let r = expand(a:path)
    return r[0] == '/' ? resolve(r) : getcwd() . "/" . r
endfun


(which breaks on Windows but that is another story).

On Mar 17, 5:17 am, John Little <[email protected]> wrote:
> :h resolve()
>
> Regards, John
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to