diff options
Diffstat (limited to 'plat.c')
-rw-r--r-- | plat.c | 27 |
1 files changed, 24 insertions, 3 deletions
@@ -5,13 +5,14 @@ #ifdef plat_posix #define _POSIX_SOURCE #define _GNU_SOURCE +#include <dirent.h> +#include <pthread.h> #include <stdarg.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> -#include <dirent.h> #include <string.h> -#include <pthread.h> +#include <sys/stat.h> +#include <unistd.h> extern int fileno(FILE*); @@ -93,6 +94,26 @@ void iter_dir(const char* path, Dir_Iter fn, void* u) { closedir(di); } +int dir_exist(const char* p) { + DIR* di; + di = opendir(p); + if (di) { + closedir(di); + return 1; + } + return 0; +} + +int make_dir(const char* p) { + return mkdir( + p, + S_IRWXU | + S_IRWXG | + S_IROTH | + S_IXOTH + ) == 0; +} + pthread_t audio_thread; pthread_mutex_t audio_mutex; |