comparison 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
comparison
equal deleted inserted replaced
0:d91dfd53b8b4 1:7abb5d8b20ea
13 char* alltoks = calloc(strlen(path), sizeof(char)), *tok; 13 char* alltoks = calloc(strlen(path), sizeof(char)), *tok;
14 14
15 for (tok = strtok(path, "\\"); tok != NULL; tok = strtok(NULL, "\\")) { 15 for (tok = strtok(path, "\\"); tok != NULL; tok = strtok(NULL, "\\")) {
16 strcat(alltoks, tok); 16 strcat(alltoks, tok);
17 if (stat(alltoks, &st) == -1) { 17 if (stat(alltoks, &st) == -1) {
18 CreateDirectoryA(alltoks, NULL); 18 if (!CreateDirectoryA(alltoks, NULL)) {
19 if (GetLastError() == ERROR_PATH_NOT_FOUND) {
20 /* ERROR_PATH_NOT_FOUND should NOT happen here */
21 return 1;
22 }
23 }
19 } 24 }
20 } 25 }
26
27 free(alltoks);
21 28
22 return 0; 29 return 0;
23 } 30 }
24 31
25 char* dirtools_concat_paths(char* a, char* b) { 32 char* dirtools_concat_paths(char* a, char* b) {