aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2020-10-12 20:32:01 +0200
committerJan200101 <sentrycraft123@gmail.com>2020-10-12 20:32:01 +0200
commite9eed79c3691e145c3c8cdb0cb07bbb2b9275874 (patch)
tree1c2c44c926bb7d1d979e7ecc424e9f9aa823b53a
parent7b64e547e3eccc4aa4515de2b86b39e16246d4ee (diff)
downloadpolecat-e9eed79c3691e145c3c8cdb0cb07bbb2b9275874.tar.gz
polecat-e9eed79c3691e145c3c8cdb0cb07bbb2b9275874.zip
append system arch to wine version if wine version was not found
-rw-r--r--src/wine.c21
-rw-r--r--src/wine.h2
2 files changed, 21 insertions, 2 deletions
diff --git a/src/wine.c b/src/wine.c
index 28f523f..4a2b10e 100644
--- a/src/wine.c
+++ b/src/wine.c
@@ -8,6 +8,7 @@
#include <linux/limits.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/utsname.h>
#include <dirent.h>
#include "wine.h"
@@ -137,15 +138,31 @@ int wine_run(int argc, char** argv)
strncat(winepath, "/", sizeof(winepath) - strlen(winepath) - 1);
strncat(winepath, winever, sizeof(winepath) - strlen(winepath) - 1);
- strncat(winepath, "/bin/wine", sizeof(winepath) - strlen(winepath) - 1);
+
+ if (!isDir(winepath))
+ {
+
+ struct utsname buffer;
+
+ if (!uname(&buffer))
+ {
+ strncat(winepath, "-", sizeof(winepath) - strlen(winepath) - 1);
+ strncat(winepath, buffer.machine, sizeof(winepath) - strlen(winepath) - 1);
+ }
+ }
+
+ strncat(winepath, WINEBIN, sizeof(winepath) - strlen(winepath) - 1);
if (isFile(winepath))
{
for (int i = 2; i < argc; ++i)
{
- strncat(winepath, " ", sizeof(winepath) - strlen(winepath) - 1);
+ strncat(winepath, " \"", sizeof(winepath) - strlen(winepath) - 1);
strncat(winepath, argv[i], sizeof(winepath) - strlen(winepath) - 1);
+ strncat(winepath, "\"", sizeof(winepath) - strlen(winepath) - 1);
}
+
+ puts(winepath);
return system(winepath);
}
else
diff --git a/src/wine.h b/src/wine.h
index 47da0f2..b36d3ee 100644
--- a/src/wine.h
+++ b/src/wine.h
@@ -1,6 +1,8 @@
#ifndef WINE_H
#define WINE_H
+#define WINEBIN "/bin/wine"
+
int wine(int, char**);
int wine_download(int, char**);
int wine_list(int, char**);