Path.Combine绝对与相对路径字符串 [英] Path.Combine absolute with relative path strings

查看:512
本文介绍了Path.Combine绝对与相对路径字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想加入Windows路径与相对路径使用<一个href="http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx"><$c$c>Path.Combine.

I'm trying to join a Windows path with a relative path using Path.Combine.

不过, Path.Combine(@C:\等等,@.. \金光闪闪)返回 C:\等等\ .. \金光闪闪而不是 C:\金光闪闪\

有谁知道如何做到这一点没有写我自己的相对路径解析(这应该不会太难)?

Does anyone know how to accomplish this without writing my own relative path resolver (which shouldn't be too hard)?

推荐答案

我这个生气也。该框架是糟糕国际海事组织,当涉及到简单的标准化。

I am annoyed by this as well. The framework is lousy IMO when it comes to simple canonicalization.

查看 Path.GetFullPath (其中涉及文件系统!)和可能的System.Uri

Check out Path.GetFullPath (which touches the file system!) and possibly System.Uri.

这篇关于Path.Combine绝对与相对路径字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆