Not all short filenames contain a tilde

Raymond Chen

I’m sure everybody has seen the autogenerated short names for long file names. For the long name “Long name for file.txt”, you might get “LONGNA~1.TXT” or possibly “LO18C9~1.TXT” if there are a lot of collisions. What you may not know is that sometimes there is no tilde at all! Each filesystem decides how it wants to implement short filenames. Windows 95 uses the “~n” method exclusively. Windows NT adds the hexadecimal hash overflow technique. But some filesystems (like Novell) just truncate the name. “Long name for file.txt” on a Novell server will come out to just “LONGNAME.TXT”.

So don’t assume that all short names contain tildes. They don’t. This means no cheating on skipping a call to GetLongFileName if you don’t see any tildes, since your optimization is invalid on Novell networks.

0 comments

Discussion is closed.

Feedback usabilla icon