Mercurial > foo_out_sdl
diff foosdk/sdk/pfc/pathUtils.h @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/foosdk/sdk/pfc/pathUtils.h Mon Jan 05 02:15:46 2026 -0500 @@ -0,0 +1,42 @@ +#pragma once + +#include <functional> +#include "string_base.h" + +namespace pfc { + namespace io { + namespace path { +#ifdef _WINDOWS + typedef string::comparatorCaseInsensitive comparator; +#else + typedef string::comparatorCaseSensitive comparator; // wild assumption +#endif + + + typedef std::function<const char* (char)> charReplace_t; + + const char * charReplaceDefault(char); + const char * charReplaceModern(char); + + string getFileName(string path); + string getFileNameWithoutExtension(string path); + string getFileExtension(string path); + string getParent(string filePath); + string getDirectory(string filePath);//same as getParent() + string combine(string basePath,string fileName); + char getDefaultSeparator(); + string getSeparators(); + bool isSeparator(char c); + string getIllegalNameChars(bool allowWC = false); + string replaceIllegalNameChars(string fn, bool allowWC = false, charReplace_t replace = charReplaceDefault); + string replaceIllegalPathChars(string fn, charReplace_t replace = charReplaceDefault); + bool isInsideDirectory(pfc::string directory, pfc::string inside); + bool isDirectoryRoot(string path); + string validateFileName(string name, bool allowWC = false, bool preserveExt = false, charReplace_t replace = charReplaceDefault);//removes various illegal things from the name, exact effect depends on the OS, includes removal of the invalid characters + + template<typename t1, typename t2> inline bool equals(const t1 & v1, const t2 & v2) {return comparator::compare(v1,v2) == 0;} + + template<typename t1, typename t2> inline int compare( t1 const & p1, t2 const & p2 ) {return comparator::compare(p1, p2); } + } + } +}
