Search code examples
perlpathcygwin

cygwin, perl, dos version of abspath()?


When running cygwin perl, is there a way to get the DOS absolute path from a cygwin path? Ideally it would also resolve cygwin symlinks.

E.g.:

'/cygdrive/c/foo' -> 'C://foo'

Solution

  • From a shell:

    cygpath -wa /cygdrive/c/foo
    

    From perl:

    system("cygpath", "-wa", "/cygdrive/c/foo")
    

    I haven't tested this with symlinks.