fedry
Member
- Joined
- Mar 25, 2008
- Messages
- 8
- Programming Experience
- Beginner
Hello all,
My issue is to combine two paths which one or both of them may contain double dots. I used Path.Combine(string, string) and the returned string is still a long path as a result of concatenating these two paths. Single or double dots are not eliminated.
So, I tried to use Path.GetFullPath(string) method with the concatenated path as the argument. PathTooLongException is thrown because this path has more than 260 characters. However, if this path is normalized, it won't exceed the maximum characters for a file path.
Anybody knows any API available in .NET to solve this issue?
--
Thank you,
Fedry
My issue is to combine two paths which one or both of them may contain double dots. I used Path.Combine(string, string) and the returned string is still a long path as a result of concatenating these two paths. Single or double dots are not eliminated.
So, I tried to use Path.GetFullPath(string) method with the concatenated path as the argument. PathTooLongException is thrown because this path has more than 260 characters. However, if this path is normalized, it won't exceed the maximum characters for a file path.
Anybody knows any API available in .NET to solve this issue?
VB.NET:
Dim s As String = Path.Combine("D:\test1\test2\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\..\..\test3\test4\", "..\test.txt")
Dim f As FileInfo = New FileInfo(Path.GetFullPath(s))
--
Thank you,
Fedry
Last edited: