summaryrefslogtreecommitdiff
path: root/plat.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-06-13 20:23:37 +1000
committerquou <quou@disroot.org>2024-06-13 20:23:37 +1000
commit9dad4016ef52ae71c0325ea9d078e499c484d51f (patch)
tree43c352394b76d33537738dbdff2f5359bbc44df0 /plat.c
parent71272f110fd00dc65bf5f028781eebb9969819b2 (diff)
playlists and stuffHEADmaster
Diffstat (limited to 'plat.c')
-rw-r--r--plat.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/plat.c b/plat.c
index a70fe52..bb8b4db 100644
--- a/plat.c
+++ b/plat.c
@@ -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;