G
Guest
Given a pathname that is all lowercase, what is the best way to recover the
"real pathname" as used by the filesystem.
This is for a Windows-explorer-like tool which has to store filenames in a
config file, and the "real paths" might have changed since the config files
were written.
For example:
Assuming the filesystem has a file called "C:\Test\test.file", how can I
perform the mapping:
"c:\test\test.file" => "C:\Test\test.file"
eg via
public string ConvertToRealPath(string path)
My current solution is to use win32APIs to perform "myName"->"windows short
name"->"windows long name", but there has to be a better way.
If I use GetDrives, Directory.GetFiles etc, the real casing is available,
but simply making a new DirectoryInfo("c:\test\test.file") does not recover
the real casing.
thanks,
Mike.
"real pathname" as used by the filesystem.
This is for a Windows-explorer-like tool which has to store filenames in a
config file, and the "real paths" might have changed since the config files
were written.
For example:
Assuming the filesystem has a file called "C:\Test\test.file", how can I
perform the mapping:
"c:\test\test.file" => "C:\Test\test.file"
eg via
public string ConvertToRealPath(string path)
My current solution is to use win32APIs to perform "myName"->"windows short
name"->"windows long name", but there has to be a better way.
If I use GetDrives, Directory.GetFiles etc, the real casing is available,
but simply making a new DirectoryInfo("c:\test\test.file") does not recover
the real casing.
thanks,
Mike.