Canonicalize a path (not a URL)
-
Hey all... I am working with .NET
1.1
(!) and I am trying to find a method that canonicalizes a filesystem path. Basically the .NET equivilent of the Win32 Shell API functionPathCanonicalize(...)
. What I need to do is convert a path like:C:\Program Files\Company\App\User1\Data\Res
**\..\..\..\**
User2\Data\MediaTo:
C:\Program Files\Company\App\User2\Data\Media
I am sure I can write code to do it (I had to in C++ before to get around the shell functions' MAX_PATH limit), but want to know if a method exists. Searching for "Canonicalize" in the MSDN help and in this forum does not yield anything useful. Adva_[
Thanks
]_nce! Peace!-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
Hey all... I am working with .NET
1.1
(!) and I am trying to find a method that canonicalizes a filesystem path. Basically the .NET equivilent of the Win32 Shell API functionPathCanonicalize(...)
. What I need to do is convert a path like:C:\Program Files\Company\App\User1\Data\Res
**\..\..\..\**
User2\Data\MediaTo:
C:\Program Files\Company\App\User2\Data\Media
I am sure I can write code to do it (I had to in C++ before to get around the shell functions' MAX_PATH limit), but want to know if a method exists. Searching for "Canonicalize" in the MSDN help and in this forum does not yield anything useful. Adva_[
Thanks
]_nce! Peace!-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFilesHi. Long time since 1.1. Have you tried the DirectoryInfo object ?
DirectoryInfo di = new DirectoryInfo(@"C:\Program Files\Company\App\User1\Data\Res\..\..\..\User2\Data\Media");
Then the di.FullName would give C:\Program Files\Company\App\User2\Data\Media Kjetil
-
Hi. Long time since 1.1. Have you tried the DirectoryInfo object ?
DirectoryInfo di = new DirectoryInfo(@"C:\Program Files\Company\App\User1\Data\Res\..\..\..\User2\Data\Media");
Then the di.FullName would give C:\Program Files\Company\App\User2\Data\Media Kjetil
I think that will do it! Thanks! Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
Hey all... I am working with .NET
1.1
(!) and I am trying to find a method that canonicalizes a filesystem path. Basically the .NET equivilent of the Win32 Shell API functionPathCanonicalize(...)
. What I need to do is convert a path like:C:\Program Files\Company\App\User1\Data\Res
**\..\..\..\**
User2\Data\MediaTo:
C:\Program Files\Company\App\User2\Data\Media
I am sure I can write code to do it (I had to in C++ before to get around the shell functions' MAX_PATH limit), but want to know if a method exists. Searching for "Canonicalize" in the MSDN help and in this forum does not yield anything useful. Adva_[
Thanks
]_nce! Peace!-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
No such method. Perhaps you meant
Path.Get_**Full**_Path
(...)? I am realizing that the documentation is lacking simple terms like "Canonicalize" unless it is talking about a URL... :doh: Peace!-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
No such method. Perhaps you meant
Path.Get_**Full**_Path
(...)? I am realizing that the documentation is lacking simple terms like "Canonicalize" unless it is talking about a URL... :doh: Peace!-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFilesApologies, I meant GetFullPath. Still, I don't think that deserved a 1 :~ (not from you, obviously, but some random guy)
Cheers, Vikram.
The hands that help are holier than the lips that pray.
-
Apologies, I meant GetFullPath. Still, I don't think that deserved a 1 :~ (not from you, obviously, but some random guy)
Cheers, Vikram.
The hands that help are holier than the lips that pray.
That was me... I hit the "not helpful" button thinking it was separate from the normal rating/voting buttons on the bottom right of the message. Sorry. Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles -
That was me... I hit the "not helpful" button thinking it was separate from the normal rating/voting buttons on the bottom right of the message. Sorry. Peace!
-=- James
Please rate this message - let me know if I helped or not! * * *
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFilesNever mind :-D As you've probably found out, you can change your votes now with the .net version of CP.
Cheers, Vikram.
The hands that help are holier than the lips that pray.