diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2020-10-20 23:37:13 +0200 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2020-10-20 23:37:13 +0200 |
commit | 7b3ee49b6aa5bcff2b46987ebc8d9cd46b9e5ac1 (patch) | |
tree | 7ce2fc46c98cd052893f01feda8b8f212f4c8f70 /src/dxvk.c | |
parent | db8ae62fb64fa33657f598a62045f17fc779ef8b (diff) | |
download | polecat-7b3ee49b6aa5bcff2b46987ebc8d9cd46b9e5ac1.tar.gz polecat-7b3ee49b6aa5bcff2b46987ebc8d9cd46b9e5ac1.zip |
improve codebase quality
- improve unreachable macro to print a message with a minor traceback then exit(0) instead of assert hackery
- add specific wine and dxvk directory methods
- rename dxvk install to download
- remove sanity asserts from lutris, caught by unreachable
- improve comments
- rename info to env
- only use a single buffer for information fetching
- fix formatting on code I had help on
- purge unused code
- if downloadToRam returns null pointer report that the archive went missing not that its invalid
- rename undescriptive "datadir" to be more specific
- remove unused code from when we stored the archive on disk
Diffstat (limited to 'src/dxvk.c')
-rw-r--r-- | src/dxvk.c | 39 |
1 files changed, 21 insertions, 18 deletions
@@ -12,7 +12,7 @@ #include "config.h" const static struct Command dxvk_commands[] = { - { .name = "install", .func = dxvk_install, .description = "download and install a dxvk version" }, + { .name = "download", .func = dxvk_download, .description = "download and install a dxvk version" }, { .name = "list", .func = dxvk_list, .description = "list available dxvk versions" }, }; @@ -30,7 +30,7 @@ int dxvk(int argc, char** argv) } -int dxvk_install(int argc, char** argv) +int dxvk_download(int argc, char** argv) { if (argc == 2) { @@ -56,24 +56,27 @@ int dxvk_install(int argc, char** argv) json_object_object_get_ex(version, "browser_download_url", &assets); char* name = basename((char*)json_object_get_string(assets)); - struct MemoryStruct* tar; + struct MemoryStruct* archive; - char datadir[PATH_MAX]; - getDataDir(datadir, sizeof(datadir)); - makeDir(datadir); + char winedir[PATH_MAX]; + getDXVKDir(winedir, sizeof(winedir)); + makeDir(winedir); - printf("Downloading %s", json_object_get_string(assets)); - //downloadFile(json_object_get_string(assets), name); - tar = downloadToRam(json_object_get_string(assets)); - - printf("Extracting %s\n", name); - - extract(tar, datadir); - - printf("Done\n"); - - free(tar->memory); - free(tar); + printf("Downloading %s\n", name); + + archive = downloadToRam(json_object_get_string(assets)); + if (archive) + { + printf("Extracting %s\n", name); + extract(archive, winedir); + } + else + { + puts("Something went wrong. The archive went missing"); + } + + free(archive->memory); + free(archive); } json_object_put(runner); |