OSDN Git Service

file/access.hpp Add.
authorMyun2 <myun2@nwhite.info>
Wed, 7 Sep 2011 13:16:33 +0000 (22:16 +0900)
committerMyun2 <myun2@nwhite.info>
Wed, 7 Sep 2011 13:16:33 +0000 (22:16 +0900)
roast/include/roast/file/access.hpp [new file with mode: 0644]

diff --git a/roast/include/roast/file/access.hpp b/roast/include/roast/file/access.hpp
new file mode 100644 (file)
index 0000000..d8f7b69
--- /dev/null
@@ -0,0 +1,44 @@
+//     Roast+ License
+/*
+       file/access
+*/
+#ifndef __SFJP_ROAST__file__access_HPP__
+#define __SFJP_ROAST__file__access_HPP__
+
+#ifdef WIN32
+       //      Windows
+       #include <io.h>
+       #ifndef F_OK
+               #define F_OK    (00)
+       #endif
+       #ifndef R_OK
+               #define R_OK    (04)
+       #endif
+       #ifndef W_OK
+               #define W_OK    (02)
+       #endif
+       #ifndef X_OK
+               #define X_OK    (F_OK)
+       #endif
+#else
+       //      Linux/UNIX
+       #include <unistd.h>
+#endif
+
+namespace roast
+{
+       namespace file
+       {
+               bool is_exist(const char* filename)
+               {
+#ifdef WIN32
+                       return _access(filename, F_OK) == 0;
+#else
+                       return access(filename, F_OK) == 0;
+#endif
+               }
+
+       }
+}
+
+#endif//__SFJP_ROAST__file__access_HPP__