Add new functions

This commit is contained in:
2025-07-27 10:23:33 +08:00
parent f4213c702c
commit 2b7ac6f12d
2 changed files with 16 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
#if HAVE_UTILS_CONFIG_H
#if HAVE_UTILS_CONFIG_H
#include "utils_config.h"
#endif
@@ -700,3 +700,11 @@ FILE* fileop::fopen(std::string path, std::string mode) {
return ::fopen(path.c_str(), mode.c_str());
#endif
}
std::string fileop::extname(std::string path) {
auto loc = path.find_last_of('.');
if (loc == std::string::npos) {
return "";
}
return path.substr(loc + 1, path.length() - loc - 1);
}