]> Nishi Git Mirror - dataworks.git/commitdiff
fix for linux
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Tue, 18 Jun 2024 00:14:37 +0000 (00:14 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Tue, 18 Jun 2024 00:14:37 +0000 (00:14 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@324 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

Installer/install.c

index 44a6046b470fa81e24c805ad94d0fb0bc9b5d592..d7c0b3c0c9aa2e5d89e8489c83680ab2b43b00f5 100644 (file)
 /* -------------------------------------------------------------------------- */
 /* --- END LICENSE --- */
 
+#ifdef __WATCOMC__
 #include <direct.h>
+#else
+#include <dirent.h>
+#include <stdint.h>
+#include <errno.h>
+#include <unistd.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -85,9 +92,15 @@ do_so:
                        free(tmp);
                }
        }
+#ifdef __WATCOM__
        FILE* in = fopen("extract.exe", "rb");
        struct stat s;
        stat("extract.exe", &s);
+#else
+       FILE* in = fopen("extract", "rb");
+       struct stat s;
+       stat("extract", &s);
+#endif
        if(in == NULL) {
                printf("%s: ", INSTALLER_ERROR);
                printf("%s\n", strerror(errno));
@@ -103,7 +116,11 @@ do_so:
                free(str);
                return 1;
        } else {
+#ifdef __WATCOMC__
                char* to = __util_strcat(str, "\\_extract.exe");
+#else
+               char* to = __util_strcat(str, "/_extract");
+#endif
                FILE* out = fopen(to, "wb");
                if(out == NULL) {
                        fclose(in);
@@ -136,6 +153,7 @@ do_so:
                fclose(out);
                printf("\n");
                int i;
+#ifdef __WATCOMC__
                for(i = 0; to[i] != 0; i++) {
                        if(to[i] == ':') {
                                unsigned total;
@@ -147,10 +165,14 @@ do_so:
                                break;
                        }
                }
+#endif
                remove("dw.exe");
                remove("dwserv.exe");
                remove("dwrcli.exe");
                remove("readme.doc");
+#ifndef __WATCOMC__
+               chmod(to, 0755);
+#endif
                system(to);
                remove(to);
                free(to);