2025-12-23 14:14:10 +11:00
|
|
|
#pragma once
|
2026-03-05 10:12:22 -06:00
|
|
|
#include <WString.h>
|
|
|
|
|
|
2025-12-30 15:09:30 +10:00
|
|
|
#include <string>
|
2026-03-05 10:12:22 -06:00
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
|
|
namespace FsHelpers {
|
|
|
|
|
|
|
|
|
|
std::string normalisePath(const std::string& path);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if the given filename ends with the specified extension (case-insensitive).
|
|
|
|
|
*/
|
|
|
|
|
bool checkFileExtension(std::string_view fileName, const char* extension);
|
|
|
|
|
inline bool checkFileExtension(const String& fileName, const char* extension) {
|
|
|
|
|
return checkFileExtension(std::string_view{fileName.c_str(), fileName.length()}, extension);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check for either .jpg or .jpeg extension (case-insensitive)
|
|
|
|
|
bool hasJpgExtension(std::string_view fileName);
|
|
|
|
|
inline bool hasJpgExtension(const String& fileName) {
|
|
|
|
|
return hasJpgExtension(std::string_view{fileName.c_str(), fileName.length()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check for .png extension (case-insensitive)
|
|
|
|
|
bool hasPngExtension(std::string_view fileName);
|
|
|
|
|
inline bool hasPngExtension(const String& fileName) {
|
|
|
|
|
return hasPngExtension(std::string_view{fileName.c_str(), fileName.length()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check for .bmp extension (case-insensitive)
|
|
|
|
|
bool hasBmpExtension(std::string_view fileName);
|
|
|
|
|
|
|
|
|
|
// Check for .gif extension (case-insensitive)
|
|
|
|
|
bool hasGifExtension(std::string_view fileName);
|
|
|
|
|
inline bool hasGifExtension(const String& fileName) {
|
|
|
|
|
return hasGifExtension(std::string_view{fileName.c_str(), fileName.length()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check for .epub extension (case-insensitive)
|
|
|
|
|
bool hasEpubExtension(std::string_view fileName);
|
|
|
|
|
inline bool hasEpubExtension(const String& fileName) {
|
|
|
|
|
return hasEpubExtension(std::string_view{fileName.c_str(), fileName.length()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check for either .xtc or .xtch extension (case-insensitive)
|
|
|
|
|
bool hasXtcExtension(std::string_view fileName);
|
|
|
|
|
|
|
|
|
|
// Check for .txt extension (case-insensitive)
|
|
|
|
|
bool hasTxtExtension(std::string_view fileName);
|
|
|
|
|
inline bool hasTxtExtension(const String& fileName) {
|
|
|
|
|
return hasTxtExtension(std::string_view{fileName.c_str(), fileName.length()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check for .md extension (case-insensitive)
|
|
|
|
|
bool hasMarkdownExtension(std::string_view fileName);
|
2025-12-23 14:14:10 +11:00
|
|
|
|
2026-03-05 10:12:22 -06:00
|
|
|
} // namespace FsHelpers
|