diff options
author | quou <quou@disroot.org> | 2024-06-13 20:23:37 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-06-13 20:23:37 +1000 |
commit | 9dad4016ef52ae71c0325ea9d078e499c484d51f (patch) | |
tree | 43c352394b76d33537738dbdff2f5359bbc44df0 /plat.c | |
parent | 71272f110fd00dc65bf5f028781eebb9969819b2 (diff) |
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; |