How can I convert "c:\foo\..\bar" into "c:\bar"?
+2
A:
I believe what you're looking for is Syetem.IO.Path
as it provides methods to deal with several issues regarding generic paths, even Internet paths.
Paulo Santos
2009-06-09 15:53:16
A:
Not a direct answer, but from the question I suspect you are trying to reinvent the System.IO.Path.Combine() method. That should eliminate the need to create paths like the one you are asking about overall.
Wyatt Barnett
2009-06-09 15:53:46
Path.Combine does not resolve "..", it simply concatenates two paths using a single path separator (depending on the platform).
0xA3
2009-06-09 16:14:00
+4
A:
Have you tried
string path = Path.GetFullPath(@"C:\foo\..\bar");
in C# using the System.IO.Path class?
Colin Desmond
2009-06-09 15:54:45