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. Given 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With