File operating functions now with ifdef.

This commit is contained in:
Kirigaya Kazuto 2017-03-23 18:47:51 +08:00
parent 7ae6b3442a
commit 1d84c5aa76

View File

@ -4,7 +4,13 @@
#include <mutex> #include <mutex>
#include <fstream> #include <fstream>
#ifdef _MSC_VER /// Visual Studio
#define _MINIENGINE_HAS_UNISTD 0
#else
#define _MINIENGINE_HAS_UNISTD 1
#include <unistd.h> #include <unistd.h>
#endif
#include "rapidxml/rapidxml.hpp" #include "rapidxml/rapidxml.hpp"
#include "rapidxml/rapidxml_print.hpp" #include "rapidxml/rapidxml_print.hpp"
@ -1307,6 +1313,7 @@ namespace MiniEngine
}/// End of namespace MiniEngine }/// End of namespace MiniEngine
#if (_MINIENGINE_HAS_UNISTD == 1)
bool isexist(std::string Path) bool isexist(std::string Path)
{ {
return access(Path.c_str(),F_OK)==0; return access(Path.c_str(),F_OK)==0;
@ -1326,6 +1333,9 @@ bool canexecute(std::string Path)
{ {
return access(Path.c_str(),X_OK)==0; return access(Path.c_str(),X_OK)==0;
} }
#else /// _MINIENGINE_HAS_UNISTD = 0
/// File Functions will be implied in platform specific source file.
#endif
/// Default Setup Code /// Default Setup Code
int main(int argc, char* argv[]) int main(int argc, char* argv[])