How to shorten a path in c# and keep it valid

Viewed 2339

I work in a place where directories have such a looong name and are in such a looong tree.

And I'm having problems with too long path names for folders in an external applicatoin (I can't change this external application, but I can give it shortened path names).

I know Microsoft operating systems can shorten path names such as transforming C:\TooLongName\TooLongSubDirectory in something like C:\TooLon~1\TooLon~1.

But how can I do this in C# and still keep the nave valid and usable?

PS: I'm not using the standard FileInfo and DirectoryInfo classes, I'm using just strings that will be sent to an external application that I cannot change in any way.

1 Answers
Related