mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
Add FileIO::exists() function
This commit is contained in:
@@ -252,6 +252,8 @@ FILE *fopen(const char *filename, const char *mode);
|
||||
size_t fread(void *buf, size_t elementSize, size_t count, FILE *f);
|
||||
size_t fwrite(const void *buf, size_t elementSize, size_t count, FILE *f);
|
||||
|
||||
bool exists(const char *filename);
|
||||
|
||||
std::string getline(FILE *f);
|
||||
|
||||
uint64_t ftell64(FILE *f);
|
||||
|
||||
@@ -373,6 +373,14 @@ int fclose(FILE *f)
|
||||
return ::fclose(f);
|
||||
}
|
||||
|
||||
bool exists(const char *filename)
|
||||
{
|
||||
struct ::stat st;
|
||||
int res = stat(filename, &st);
|
||||
|
||||
return (res == 0);
|
||||
}
|
||||
|
||||
void *logfile_open(const char *filename)
|
||||
{
|
||||
int fd = open(filename, O_APPEND | O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
|
||||
@@ -466,6 +466,16 @@ FILE *fopen(const char *filename, const char *mode)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool exists(const char *filename)
|
||||
{
|
||||
wstring wfn = StringFormat::UTF82Wide(filename);
|
||||
|
||||
struct _stat st;
|
||||
int res = _wstat(wfn.c_str(), &st);
|
||||
|
||||
return (res == 0);
|
||||
}
|
||||
|
||||
string getline(FILE *f)
|
||||
{
|
||||
string ret;
|
||||
|
||||
Reference in New Issue
Block a user