开发者

Create relative path between two paths [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to get relative path from absolute path

I'm currently using the FolderBrowserDialog to return an absolute path. I would like to instead get the relative path with respect to the currently executing directory. Gi开发者_如何学JAVAven that FolderBrowserDialog only returns an absolute path, is there a way to translate this to a relative path?


You want to use Uri.MakeRelativeUri(uri). Get your current executing assembly, store it as a Uri. Create a second Uri from the directory from your Folder browser, and use MakeRelativeUri(). I asked a similar question touching on this, that goes in to details of properly decoding the Uri so that the path is a valid form for a Windows folder.

Removing %20 from URI Relative Path

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜