feat(util): add SFile::FileExists

This commit is contained in:
fallenoak committed 2025-10-30 23:04:29 -05:00
1 parent 9bfe4428e3
commit ea8b7ca0b8
2 files changed
+17

No files matched your search

+16
View File
@@ -16,6 +16,22 @@ int32_t SFile::Close(SFile* file) {
return 1;
}
// TODO Proper implementation
int32_t SFile::FileExists(const char* filename) {
auto pathLen = SStrLen(filename);
char path[STORM_MAX_PATH];
SStrCopy(path, filename, sizeof(path));
for (int32_t i = 0; i < pathLen; ++i) {
if (path[i] == '\\') {
path[i] = '/';
}
}
std::ifstream f(path);
return f.good();
}
// TODO Proper implementation
size_t SFile::GetFileSize(SFile* file, size_t* filesizeHigh) {
return file->m_size;
+1
View File
@@ -14,6 +14,7 @@ class SFile {
public:
// Static functions
static int32_t Close(SFile*);
static int32_t FileExists(const char* filename);
static size_t GetFileSize(SFile*, size_t*);
static int32_t IsStreamingMode();
static int32_t IsStreamingTrial();