Public Group

Cleaning a path

This topic is 5195 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Does anyone know of a nice little function that cleans a directory structured path, such as this..
C:\DirA\DirB\..\DirC\..\DirB\DirD\..\..\DirB\X
Which could be cleaned up to
C:\DirA\DirB\X
I know it's as simple as backtracking to the last slash for each ..\, but I would rather use a standard function if such a thing exists? Thanks for help.

Share on other sites
For Windows you can use PathCanonicalize.

This requires IE 4.0 on Win95/NT 4.0 (which can still be an issue).

Share on other sites
Ahh, thanks. I'm wondering if this function can use the same string buffer for destination and source. Doesn't say anything in the docs. I would guess that means no.

Very strange that such a simple task requires internet explorer. Microsoft keeps me guessing [evil]

Thanks again.

Share on other sites
Quote:
 Original post by Jiia...snip...Very strange that such a simple task requires internet explorer. Microsoft keeps me guessingThanks again.

Yeah, they kept adding a lot of neat stuff using IE to basically update Windows. Thank god they stopped doing that again.

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5
frob
12

• 9
• 9
• 11
• 11
• 23
• Forum Statistics

• Total Topics
633665
• Total Posts
3013245
×