mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(util): add SFile::FileExists
This commit is contained in:
parent
9bfe4428e3
commit
ea8b7ca0b8
@ -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;
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user