about summary refs log tree commit diff
path: root/config.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-10 19:40:13 -0500
committerJune McEnroe <june@causal.agency>2020-02-10 19:40:13 -0500
commitb59431bb15ec74f05119a7c710a1f6a21e702bad (patch)
treeaa80af87cf2af090dc8d243a80577d8bd5b2106c /config.c
parentShow heat and other unread in title (diff)
downloadcatgirl-b59431bb15ec74f05119a7c710a1f6a21e702bad.tar.gz
catgirl-b59431bb15ec74f05119a7c710a1f6a21e702bad.zip
Add -s to save and load buffers
Diffstat (limited to '')
-rw-r--r--config.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/config.c b/config.c
index b3e42f9..3bf56c0 100644
--- a/config.c
+++ b/config.c
@@ -24,8 +24,6 @@
 
 #include "chat.h"
 
-#define CONFIG_DIR "catgirl"
-
 FILE *configOpen(const char *path, const char *mode) {
 	if (path[0] == '/' || path[0] == '.') goto local;
 
@@ -35,10 +33,10 @@ FILE *configOpen(const char *path, const char *mode) {
 
 	char buf[PATH_MAX];
 	if (configHome) {
-		snprintf(buf, sizeof(buf), "%s/" CONFIG_DIR "/%s", configHome, path);
+		snprintf(buf, sizeof(buf), "%s/" XDG_SUBDIR "/%s", configHome, path);
 	} else {
 		if (!home) goto local;
-		snprintf(buf, sizeof(buf), "%s/.config/" CONFIG_DIR "/%s", home, path);
+		snprintf(buf, sizeof(buf), "%s/.config/" XDG_SUBDIR "/%s", home, path);
 	}
 	FILE *file = fopen(buf, mode);
 	if (file) return file;
@@ -48,7 +46,7 @@ FILE *configOpen(const char *path, const char *mode) {
 	while (*configDirs) {
 		size_t len = strcspn(configDirs, ":");
 		snprintf(
-			buf, sizeof(buf), "%.*s/" CONFIG_DIR "/%s",
+			buf, sizeof(buf), "%.*s/" XDG_SUBDIR "/%s",
 			(int)len, configDirs, path
 		);
 		file = fopen(buf, mode);