# HG changeset patch # User Paper <37962225+mrpapersonic@users.noreply.github.com> # Date 1652417291 14400 # Node ID d873a04165f9b7d09218ecb634270782f487de2e # Parent 02e46804c923ad753f835b43f5003baeededfe66 use basename() on cli version really stupid bug lol diff -r 02e46804c923 -r d873a04165f9 src/main.c --- a/src/main.c Fri Apr 22 02:24:44 2022 -0400 +++ b/src/main.c Fri May 13 00:48:11 2022 -0400 @@ -5,6 +5,7 @@ #include #include #include +#include #ifdef _MSC_VER #define strdup(p) _strdup(p) #endif @@ -148,13 +149,13 @@ } fflush(stdout); if (strcmp(args.output, " ") == 0) { /* string manipulation hell */ - char temp[256] = {'V'}; + char temp[256] = (char*)malloc(sizeof(char)*256); char str_version[16] = {}; - sprintf(str_version, "%d", args.version); + sprintf(str_version, "V%d", args.version); strncat(temp, str_version, 2); strncat(temp, "_", 1); - strncat(temp, args.input, 248); - strcpy(temp, strremove(temp, strrchr(args.input, ('.')))); /* remove file extension */ + strncat(temp, basename(args.input), 248); + strcpy(temp, strremove(temp, strrchr(basename(args.input), ('.')))); /* remove file extension */ strncat(temp, ".", 1); strncat(temp, args.type, 3); strncpy(args.output, temp, 255);