Add file system helper.

This commit is contained in:
castano 2008-11-22 22:07:07 +00:00
parent 4a1cbadfa6
commit 67b9def0e8
2 changed files with 52 additions and 0 deletions

31
trunk/src/nvcore/FileSystem.cpp Executable file
View File

@ -0,0 +1,31 @@
// This code is in the public domain -- castano@gmail.com
#include "FileSystem.h"
#include <nvcore/nvcore.h>
#if NV_OS_WIN32
#include <direct.h>
#else
#include <sys/stat.h>
#include <sys/types.h>
//#include <unistd.h>
#endif
using namespace nv;
bool FileSystem::exists(const char * path)
{
// stat buf;
// stat(path, &buf);
return false;
}
bool FileSystem::createDirectory(const char * path)
{
#if NV_OS_WIN32
return _mkdir(path) != -1;
#else
return mkdir(path, 0777) != -1;
#endif
}

21
trunk/src/nvcore/FileSystem.h Executable file
View File

@ -0,0 +1,21 @@
// This code is in the public domain -- castano@gmail.com
#ifndef NV_CORE_FILESYSTEM_H
#define NV_CORE_FILESYSTEM_H
namespace nv
{
namespace FileSystem
{
bool exists(const char * path);
bool createDirectory(const char * path);
} // FileSystem namespace
} // nv namespace
#endif // NV_CORE_FILESYSTEM_H