diff src/dirtools.c @ 1:7abb5d8b20ea v1.0

Initial commit: part 2 I added a config GUI, and actual stuff to the README. The GUI was 'made' in Visual Studio, but I trimmed down the resource file because it had weird VS2010 skid marks all over it.
author Paper <mrpapersonic@gmail.com>
date Sun, 07 Aug 2022 10:23:10 -0400
parents d91dfd53b8b4
children 8df8af626dca
line wrap: on
line diff
--- a/src/dirtools.c	Sun Aug 07 07:26:27 2022 -0400
+++ b/src/dirtools.c	Sun Aug 07 10:23:10 2022 -0400
@@ -15,10 +15,17 @@
 	for (tok = strtok(path, "\\"); tok != NULL; tok = strtok(NULL, "\\")) {
 		strcat(alltoks, tok);
 		if (stat(alltoks, &st) == -1) {
-			CreateDirectoryA(alltoks, NULL);
+			if (!CreateDirectoryA(alltoks, NULL)) {
+				if (GetLastError() == ERROR_PATH_NOT_FOUND) {
+					/* ERROR_PATH_NOT_FOUND should NOT happen here */
+					return 1;
+				}
+			}
 		}
 	}
 
+	free(alltoks);
+
 	return 0;
 }