diff options
-rw-r--r-- | src/wine.c | 21 | ||||
-rw-r--r-- | src/wine.h | 2 |
2 files changed, 21 insertions, 2 deletions
@@ -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 @@ -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**); |