Add file system helper.
This commit is contained in:
parent
379605d30a
commit
e3a7cc19dd
31
src/nvcore/FileSystem.cpp
Executable file
31
src/nvcore/FileSystem.cpp
Executable 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
src/nvcore/FileSystem.h
Executable file
21
src/nvcore/FileSystem.h
Executable 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
|
Loading…
Reference in New Issue
Block a user