C# 中是否有与 PHP 的UNIX 路径的realpath等效的函数?
我找不到任何东西,而且从头开始写一个似乎很耗时。
我知道GetFullPath但它有以下问题(对我来说):
- 这是一个正在返回的 Windows 路径,因此返回类似
"//foo//../bar///c","t:\bar\c"的内容。 - 它从目录名称中删除空格,因此返回类似
"/foo bar/baz","t:\foobar\baz"的内容。 - Giving
Console.WriteLine(Path.GetFullPath( "//d/"));甚至没有编译,我得到这个ArgumentExcpetion消息:The UNC path should be of the form \\server\share.