about summary refs log tree commit diff stats
path: root/src/os/os_linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/os_linux.c')
-rw-r--r--src/os/os_linux.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/os/os_linux.c b/src/os/os_linux.c
index 29d0a1d1..d1a940b5 100644
--- a/src/os/os_linux.c
+++ b/src/os/os_linux.c
@@ -9,6 +9,7 @@
 #include <string.h>
 #include <stdarg.h>
 #include <stdlib.h>
+#include <errno.h>
 
 #include "os.h"
 #include "signals.h"
@@ -229,4 +230,23 @@ int FileExist(const char* filename, int flags)
             return 0; // nope
     }
     return 1;
+}
+
+int MakeDir(const char* folder)
+{
+    int ret = mkdir(folder, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+    if(!ret || ret==EEXIST)
+        return 1;
+    return 0;
+}
+
+size_t FileSize(const char* filename)
+{
+    struct stat sb;
+    if (stat(filename, &sb) == -1)
+        return 0;
+    // check type of file? should be executable, or folder
+    if (!S_ISREG(sb.st_mode))
+        return 0;
+    return sb.st_size;
 }
\ No newline at end of file