Quantcast
Channel: How to get relative path from absolute path - Stack Overflow
Browsing all 25 articles
Browse latest View live

Answer by Jonathan Leffler for How to get relative path from absolute path

As Alex Brault points out, especially on Windows, the absolute path (with drive letter and all) is unambiguous and often better.Shouldn't your OpenFileDialog use a regular tree-browser structure?To get...

View Article


Answer by DavidK for How to get relative path from absolute path

There is a Win32 (C++) function in shlwapi.dll that does exactly what you want: PathRelativePathTo()I'm not aware of any way to access this from .NET other than to P/Invoke it, though.

View Article


Answer by 3Doubloons for How to get relative path from absolute path

I'd split both of your paths at the directory level. From there, find the point of divergence and work your way back to the assembly folder, prepending a '../' everytime you pass a directory.Keep in...

View Article

Answer by Kevin for How to get relative path from absolute path

Use:RelPath = AbsPath.Replace(ApplicationPath, ".")

View Article

How to get relative path from absolute path

There's a part in my apps that displays the file path loaded by the user through OpenFileDialog. It's taking up too much space to display the whole path, but I don't want to display only the filename...

View Article

Browsing all 25 articles
Browse latest View live