Implement FileSystem::exists().

pull/216/head
castano 16 years ago
parent 508f9fbdc2
commit 10de10b9c2

@ -8,7 +8,7 @@
#else
#include <sys/stat.h>
#include <sys/types.h>
//#include <unistd.h>
#include <unistd.h>
#endif
using namespace nv;
@ -16,9 +16,17 @@ using namespace nv;
bool FileSystem::exists(const char * path)
{
// stat buf;
// stat(path, &buf);
return false;
#if NV_OS_UNIX
struct stat buf;
return stat(path, &buf) == 0;
#else
if (FILE * fp = fopen(path, "r"))
{
fclose(fp);
return true;
}
return false;
#endif
}
bool FileSystem::createDirectory(const char * path)
@ -29,3 +37,4 @@ bool FileSystem::createDirectory(const char * path)
return mkdir(path, 0777) != -1;
#endif
}

Loading…
Cancel
Save