From 94a5c2c299701ed6d389c0c397254c00127304ad Mon Sep 17 00:00:00 2001 From: david Date: Sun, 5 Jul 2026 14:19:31 -0300 Subject: fixed a thing i forgot to fix the other day --- imagesortc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'imagesortc.c') diff --git a/imagesortc.c b/imagesortc.c index 00e6407..f699e98 100644 --- a/imagesortc.c +++ b/imagesortc.c @@ -154,9 +154,14 @@ int main(int argc, char **argv){ sdlcleanup(&displayerer, images, dir, count, EXIT_FAILURE); } - mkdir("../saved", 0755); - mkdir("../other", 0755); - mkdir("../delete", 0755); + char saveddir[1024], otherdir[1024], deletedir[1024]; + snprintf(saveddir, sizeof(saveddir), "%s/saved", path); + snprintf(otherdir, sizeof(otherdir), "%s/other", path); + snprintf(deletedir, sizeof(deletedir), "%s/delete", path); + + mkdir(saveddir, 0755); + mkdir(otherdir, 0755); + mkdir(deletedir, 0755); if(sdlinit(&displayerer)){ sdlcleanup(&displayerer, images, dir, count, EXIT_FAILURE); @@ -208,7 +213,7 @@ int main(int argc, char **argv){ SDL_StopTextInput(); char *ext = strrchr(images[whichone], '.'); char savedbuf[1024]; - snprintf(savedbuf, sizeof(savedbuf), "../saved/%s%s", textbuf, ext ? ext : ""); + snprintf(savedbuf, sizeof(savedbuf), "%s/%s%s", saveddir, textbuf, ext ? ext : ""); rename(images[whichone], savedbuf); if(whichone + 1 < count){ whichone++; @@ -237,7 +242,7 @@ int main(int argc, char **argv){ case SDL_SCANCODE_S: if(!typing){ char otherbuf[1024]; - snprintf(otherbuf, sizeof(otherbuf), "../other/%s", strrchr(images[whichone], '/') + 1); + snprintf(otherbuf, sizeof(otherbuf), "%s/%s", otherdir, strrchr(images[whichone], '/') + 1); rename(images[whichone], otherbuf); if(whichone + 1 < count){ whichone++; @@ -249,7 +254,7 @@ int main(int argc, char **argv){ case SDL_SCANCODE_D: if(!typing){ char otherbuf[1024]; - snprintf(otherbuf, sizeof(otherbuf), "../delete/%s", strrchr(images[whichone], '/') + 1); + snprintf(otherbuf, sizeof(otherbuf), "%s/%s", deletedir, strrchr(images[whichone], '/') + 1); rename(images[whichone], otherbuf); if(whichone + 1 < count){ whichone++; -- cgit v1.3-2-g0d8e