36 lines
914 B
C++
36 lines
914 B
C++
#pragma once
|
|
|
|
#include "XNCore_global.h"
|
|
#include "XNString.h"
|
|
#include "XNType.h"
|
|
#include <filesystem>
|
|
#include <fstream>
|
|
|
|
namespace XNSim {
|
|
using XN_PATH = std::filesystem::path;
|
|
// 流相关类型别名
|
|
using XN_OFSTREAM = std::ofstream;
|
|
using XN_IFSTREAM = std::ifstream;
|
|
using XN_FSTREAM = std::fstream;
|
|
|
|
FORCEINLINE XN_PATH getCurrentPath() { return std::filesystem::current_path(); }
|
|
FORCEINLINE bool isExist(const XN_PATH &path) {
|
|
return std::filesystem::exists(path);
|
|
}
|
|
|
|
FORCEINLINE bool isDirectory(const XN_PATH &path) {
|
|
return std::filesystem::is_directory(path);
|
|
}
|
|
|
|
FORCEINLINE void createDirectory(const XN_PATH &path) {
|
|
std::filesystem::create_directories(path);
|
|
}
|
|
|
|
FORCEINLINE XN_STRING getFileNameWithoutExt(const XN_STRING &path) {
|
|
XN_SIZE lastDot = path.find_last_of('.');
|
|
if (lastDot != XN_STRING::npos) {
|
|
return path.substr(0, lastDot);
|
|
}
|
|
return path;
|
|
}
|
|
} // namespace XNSim
|