From d03cce5fb5f54016f0109003d7faea9c68b68cbf Mon Sep 17 00:00:00 2001 From: Legend <100516800+FoIIower@users.noreply.github.com> Date: Sat, 26 Mar 2022 00:17:07 +0300 Subject: [PATCH 1/2] Fix ETC_DIR for unrooted Android/Termux On unrooted phones this will cause permission denied error. Or we are targeting only rooted Android devices? --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 1e48a85..8c575b0 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ ifeq ($(PLATFORM), Linux) MANDIR = share/man/man1 ifeq ($(shell uname -o), Android) DESTDIR = /data/data/com.termux/files/usr + ETC_DIR = $(DESTDIR)/etc endif else ifeq ($(PLATFORM), Darwin) PREFIX = local/bin From 23c38bcc225dc890193bdda030c83ac3b0af8bf3 Mon Sep 17 00:00:00 2001 From: Legend <100516800+FoIIower@users.noreply.github.com> Date: Sat, 26 Mar 2022 09:47:11 +0300 Subject: [PATCH 2/2] Add support for $PREFIX --- uwufetch.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/uwufetch.c b/uwufetch.c index 86a7798..7feaae9 100644 --- a/uwufetch.c +++ b/uwufetch.c @@ -162,8 +162,14 @@ struct configuration parse_config(struct info* user_info) { char homedir[512]; sprintf(homedir, "%s/.config/uwufetch/config", getenv("HOME")); config = fopen(homedir, "r"); - if (!config) - config = fopen("/etc/uwufetch/config", "r"); + if (!config) { + if(getenv("PREFIX") != NULL) { + char prefixed_etc[512]; + sprintf(prefixed_etc, "%s/etc/uwufetch/config", getenv("PREFIX")); + config = fopen(prefixed_etc, "r"); + } else + config = fopen("/etc/uwufetch/config", "r"); + } } } else config = fopen(user_info->config_directory, "r");