// // Created by xtkuang on 2025/6/11. // #ifndef OS_H #define OS_H #include #include #include inline bool pathExists(const std::string& path) { struct stat info; return stat(path.c_str(), &info) == 0; } inline std::vector splitString(const std::string& pattern, const std::string& delimiter) { std::vector result; if (delimiter.empty()) { result.push_back(pattern); // 若分隔符为空,则原样返回 return result; } size_t start = 0; size_t end; while ((end = pattern.find(delimiter, start)) != std::string::npos) { result.push_back(pattern.substr(start, end - start)); start = end + delimiter.length(); } result.push_back(pattern.substr(start)); return result; } #endif //OS_H