14 for (
char const& ch : s)
16 if (std::isdigit(ch) == 0)
27 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
29 return minizip::util::checkZipFile(mPath);
37 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
39 auto z = minizip::util::ensureZipFile(mPath, createIfNotExistent);
49 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
51 return minizip::util::checkIfFolderInZipExists(mPath, p);
59 const std::filesystem::path& p,
60 bool createIfNotExistent)
62 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
64 return minizip::util::ensureFolderInZipExists(mPath, p, createIfNotExistent);
73 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
75 return minizip::util::checkIfFileInZipExists(mPath, p);
84 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
86 return minizip::util::ensureFileInZipExists(mPath, p);
94 const std::filesystem::path& p,
95 const std::vector<unsigned char>&
data)
97 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
99 return minizip::util::writeDataInFileInZipFile(mPath, p,
data);
107 const std::filesystem::path& p,
108 const std::vector<unsigned char>&
data,
109 const unsigned int maxTries,
110 const unsigned int sleepTimeMs)
112 for (
unsigned int i = 0; i < maxTries; ++i)
122 std::this_thread::sleep_for(std::chrono::milliseconds(sleepTimeMs));
128 "ATTENTION! Even after " + std::to_string(maxTries) +
129 " tries, the memory was not able to store the instance at path '" + p.string() +
130 "'. This means this instance will be lost!");
133 std::vector<unsigned char>
136 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
138 return minizip::util::readDataFromFileInZipFile(mPath, p);
144 std::vector<std::string>
147 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
155 std::vector<std::string>
156 getAllFiles(
const std::filesystem::path& mPath,
const std::filesystem::path& p)
158 if (mPath.extension() == minizip::util::MINIZIP_SUFFIX)
Base class for all exceptions thrown by the armem library.
void ensureFolderInFilesystemExists(const std::filesystem::path &p, bool createIfNotExistent)
std::vector< std::string > getAllFilesystemDirectories(const std::filesystem::path path)
std::vector< std::string > getAllFilesystemFiles(const std::filesystem::path path)
void ensureFileInFilesystemExists(const std::filesystem::path &p)
std::vector< unsigned char > readDataFromFilesystemFile(const std::filesystem::path path)
bool checkIfFileInFilesystemExists(const std::filesystem::path &p)
void writeDataInFilesystemFile(const std::filesystem::path &p, const std::vector< unsigned char > &data)
bool checkIfFolderInFilesystemExists(const std::filesystem::path &p)
bool checkIfFolderExists(const std::filesystem::path &mPath, const std::filesystem::path &p)
bool checkIfBasePathExists(const std::filesystem::path &mPath)
std::vector< std::string > getAllDirectories(const std::filesystem::path &mPath, const std::filesystem::path &p)
void ensureBasePathExists(const std::filesystem::path &mPath, bool createIfNotExistent)
std::vector< std::string > getAllFiles(const std::filesystem::path &mPath, const std::filesystem::path &p)
bool checkIfFileExists(const std::filesystem::path &mPath, const std::filesystem::path &p)
void ensureFolderExists(const std::filesystem::path &mPath, const std::filesystem::path &p, bool createIfNotExistent)
std::vector< unsigned char > readDataFromFile(const std::filesystem::path &mPath, const std::filesystem::path &p)
bool isNumber(const std::string &s)
void writeDataToFile(const std::filesystem::path &mPath, const std::filesystem::path &p, const std::vector< unsigned char > &data)
void ensureFileExists(const std::filesystem::path &mPath, const std::filesystem::path &p)
void writeDataToFileRepeated(const std::filesystem::path &mPath, const std::filesystem::path &p, const std::vector< unsigned char > &data, const unsigned int maxTries, const unsigned int sleepTimeMs)