开发者

How to revolve full path of a symlink?

开发者 https://www.devze.com 2023-04-11 01:55 出处:网络
In Groovy/Ant, I need to get the actual path that a particular symlink points to. For example, if I have some开发者_开发技巧 symlink foo pointing at /home/documents/bar

In Groovy/Ant, I need to get the actual path that a particular symlink points to. For example, if I have some开发者_开发技巧 symlink foo pointing at /home/documents/bar

foo -> /home/documents/bar

Is there a way to take foo and resolve it to a pathname?


Until Java 7, can't you use:

println file.canonicalPath

To get the path that the link points to? Where:

println file.absolutePath

Prints the path to the symlink

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号