diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2020-08-18 23:58:16 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2020-08-18 23:58:16 +0200 |
commit | d53109eaa890ab807b66961a89291cea3cd3c003 (patch) | |
tree | a62382b32014266f5aecb6f639d0962bb1682bf0 /src/wine.c | |
parent | 1753e2b151cbb4af75a4e9ea61720b3704b03805 (diff) | |
download | polecat-d53109eaa890ab807b66961a89291cea3cd3c003.tar.gz polecat-d53109eaa890ab807b66961a89291cea3cd3c003.zip |
first part of a proper lutris implementation and cleanup0.1.4
- remove all old build platform related variables
- change behavior of clean
- change tabs into spaces
- make XDG fetching method static
- replace strcpy and cat with strn alternative with proper bounds checking
- add cache dir
- reenable dxvk and download from ram
- completely rework lutris fetching and convert it into an interal struct
- only show http errors in debug
- add sanity checks to methods with possible NULL return
- change extracting methods to extract tar from ram
Diffstat (limited to 'src/wine.c')
-rw-r--r-- | src/wine.c | 33 |
1 files changed, 23 insertions, 10 deletions
@@ -64,19 +64,32 @@ int wine_download(int argc, char** argv) char datadir[PATH_MAX]; char downloadpath[PATH_MAX]; + struct MemoryStruct* tar; - getDataDir(datadir); + getDataDir(datadir, sizeof(datadir)); makeDir(datadir); - strcpy(downloadpath, datadir); - strcat(downloadpath, "/"); - strcat(downloadpath, name); + strncpy(downloadpath, datadir, sizeof(downloadpath)); + strncat(downloadpath, "/", sizeof(downloadpath) - strlen(downloadpath)); + strncat(downloadpath, name, sizeof(downloadpath) - strlen(downloadpath)); printf("Downloading %s\n", name); - downloadFile(json_object_get_string(url), downloadpath); - printf("Extracting %s\n", name); - extract(downloadpath, datadir); - printf("Done\n"); + + tar = downloadToRam(json_object_get_string(url)); + if (tar) + { + printf("Extracting %s\n", name); + extract(tar, datadir); + puts("Done"); + } + else + { + puts("Something went wrong. The tar is not valid"); + } + + + free(tar->memory); + free(tar); } json_object_put(runner); @@ -118,7 +131,7 @@ int wine_run(int argc, char** argv) if (argc > 1) { char winepath[PATH_MAX]; - getDataDir(winepath); + getDataDir(winepath, sizeof(winepath)); char* winever = argv[1]; strcat(winepath, "/"); @@ -142,7 +155,7 @@ int wine_run(int argc, char** argv) int wine_installed(int argc, char** argv) { char datadir[PATH_MAX]; - getDataDir(datadir); + getDataDir(datadir, sizeof(datadir)); DIR *dir; struct dirent *ent; |