summaryrefslogtreecommitdiff
path: root/src/windows/cache.c
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2022-11-06 16:28:17 -0800
committerLouie S <louie@example.com>2022-11-06 16:28:17 -0800
commit2c29b6a5145a4c44cbef03197db64cd2d7decd15 (patch)
treedb4129c7efad3b79ee1b21c5ed4ef634044de5eb /src/windows/cache.c
parent77c6ef13a0599fdb9966a3a7dc967e204b77c7d5 (diff)
Basic functionality for using autotools over basic Makefile
Diffstat (limited to 'src/windows/cache.c')
-rw-r--r--src/windows/cache.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/windows/cache.c b/src/windows/cache.c
new file mode 100644
index 0000000..01db0ef
--- /dev/null
+++ b/src/windows/cache.c
@@ -0,0 +1,30 @@
+#include <assert.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "../include/cache.h"
+#include "../include/read_cfg.h"
+
+char *get_cache_path(bool create){
+ char *path = malloc(sizeof(char) * BUF_LEN);
+ char *appdata = getenv("APPDATA");
+
+ if(appdata == NULL){
+ printf("Failed to save cache data: APPDATA is not set\n");
+ free(path);
+ return NULL;
+ }
+
+ //if create is asserted, build the path to the file
+ if(create){
+ sprintf(path, "%s%cterminal-media-launcher%c", appdata, sep, sep);
+ mkdir(path);
+ }
+
+ sprintf(path, "%s%cterminal-media-launcher%ccache.bin", appdata, sep, sep);
+
+ return path;
+}