1#include <wx/filename.h>
2#include "../../kernel.hpp"
17 const std::string sINVALID_CHARS =
"\"#%&|*?";
20 for (
size_t i = 0; i < sPathname.length(); i++)
22 if (sPathname[i] ==
'~' || sINVALID_CHARS.find(sPathname[i]) != std::string::npos)
48 if (sPathname.find(
':', 2) != std::string::npos || sPathname.find_first_of(
"<>") != std::string::npos)
52 if (sPathname[2] !=
'/' && !(sPathname.substr(0,2) ==
"//" && isalpha(sPathname[2])))
75 sPathname = fileSystemInstance.
ValidFileName(sPathname,
"",
false,
false);
78 if (sPathname.find(
':', 2) != std::string::npos || sPathname.find_first_of(
"<>") != std::string::npos)
82 if (sPathname[2] !=
'/' && !(sPathname.substr(0,2) ==
"//" && isalpha(sPathname[2])))
86 if (sPathname.find_last_of(
".") == std::string::npos || sPathname.back() ==
'.')
90 size_t extStart = sPathname.find_last_of(
".");
91 std::string ext = sPathname.substr(extStart + 1, sPathname.length() - extStart);
92 if (!std::all_of(ext.begin(), ext.end(), [](
char const &c) { return std::isalnum(c);}))
96 if (!isalnum(sPathname[sPathname.find_last_of(
".") - 1]))
This class implements the basic input/ output file system and provides functionalities to work with f...
std::string ValidFolderName(std::string _sFileName, bool doCleanPath=true, bool appendTrailingSeparator=true) const
This member function evaluates, whether the passed foldername is a valid foldername.
std::string ValidFileName(std::string _sFileName, const std::string sExtension=".dat", bool checkExtension=true, bool doCleanPath=true) const
This member function evaluates, whether the passed filename is a valid filename. One may supply a pre...
static NumeReKernel * getInstance()
This static member function returns a a pointer to the singleton instance of the kernel.
FileSystem & getFileSystem()
static bool checkInvalidChars(std::string sPathname)
This function checks for the invalid chars that can not appear in a valid directory name.
bool is_file(std::string sPathname)
This function checks whether a given string is a valid file path.
bool is_dir(std::string sPathname)
This function checks whether a given string is a valid directory path.