Introduction
Most applications have to handle path names somewhere along the way. This simple class (actually it's more a collection of static methods) provides nine functions that make the different parts of a path accessible. Groundbreaking ideas are not included, but creating relative path names in any direction across a drive might be a useful feature.
Using the code
The most often problems should have the most easiest solutions. So here it comes:
CString drive = PathInfo::getDrive(Path);
CString dir = PathInfo::getDirectory(Path);
CString folder = PathInfo::getFolder(Path);
CString name = PathInfo::getName(Path);
CString title = PathInfo::getTitle(Path);
CString extsn = PathInfo::getExtension(Path);
CString cfgPath = PathInfo::getPathAs(Path, "cfg");
CString relPath = PathInfo::getRelPath(Path, Origin);
CString absPath = PathInfo::getAbsPath(relPath, Origin);
History
Version 1.1
Changed:
- The GUI now allows textual input for testing purpose.
getRelPath()
now uses _strnicmp()
to compare strings.
Version 1.0
Added:
getDrive()
getDirectory()
getFolder()
getName()
getTitle()
getExtension()
getPathAs()
getRelPath()
getAbsPath()