trying to figure out why webcit doesn't chdir properly when run from appimage
authorArt Cancro <ajc@citadel.org>
Mon, 11 Jan 2021 21:36:30 +0000 (21:36 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 11 Jan 2021 21:36:30 +0000 (21:36 +0000)
appimage/ctdlvisor.c

index 63230af..5f088de 100644 (file)
@@ -42,10 +42,12 @@ pid_t start_citadel() {
 pid_t start_webcit() {
        char bin[1024];
        sprintf(bin, "%s/usr/local/webcit/webcit", getenv("APPDIR"));
+       char wchome[1024];
+       sprintf(wchome, "-h%s/usr/local/webcit", getenv("APPDIR"));
        pid_t pid = fork();
        if (pid == 0) {
                printf("Executing %s\n", bin);
-               execlp(bin, "webcit", "-x9", "-p80", "uds", "/usr/local/citadel", NULL);
+               execlp(bin, "webcit", "-x9", wchome, "-p80", "uds", "/usr/local/citadel", NULL);
                perror("execlp");
                exit(errno);
        }
@@ -58,10 +60,12 @@ pid_t start_webcit() {
 pid_t start_webcits() {
        char bin[1024];
        sprintf(bin, "%s/usr/local/webcit/webcit", getenv("APPDIR"));
+       char wchome[1024];
+       sprintf(wchome, "-h%s/usr/local/webcit", getenv("APPDIR"));
        pid_t pid = fork();
        if (pid == 0) {
                printf("Executing %s\n", bin);
-               execlp(bin, "webcit", "-x9", "-s", "-p443", "uds", "/usr/local/citadel", NULL);
+               execlp(bin, "webcit", "-x9", wchome, "-s", "-p443", "uds", "/usr/local/citadel", NULL);
                perror("execlp");
                exit(errno);
        }