comparison th_file.c @ 685:18b7c2c9f838

Oops, fix previous commit.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Mar 2020 00:12:16 +0200
parents a6e7a29ecd30
children a54298eef91a
comparison
equal deleted inserted replaced
684:a6e7a29ecd30 685:18b7c2c9f838
158 { 158 {
159 char save, *path = th_strdup(cpath); 159 char save, *path = th_strdup(cpath);
160 size_t start = 0, end; 160 size_t start = 0, end;
161 BOOL res = FALSE; 161 BOOL res = FALSE;
162 162
163 // If mode is 0, default to something sensible
164 if (mode == 0)
165 mode = 0711;
166
167 // Start creating the directory stucture 163 // Start creating the directory stucture
168 do 164 do
169 { 165 {
170 // Split foremost path element out 166 // Split foremost path element out
171 for (save = 0, end = start; path[end] != 0; end++) 167 for (save = 0, end = start; path[end] != 0; end++)
188 { 184 {
189 #if defined(TH_PLAT_WINDOWS) 185 #if defined(TH_PLAT_WINDOWS)
190 if (!CreateDirectory(path, NULL)) 186 if (!CreateDirectory(path, NULL))
191 goto error; 187 goto error;
192 #else 188 #else
193 if (mkdir(path, mode) < 0) 189 if (mkdir(path, mode != 0 ? mode : 0711) < 0)
194 goto error; 190 goto error;
195 #endif 191 #endif
196 } 192 }
197 } 193 }
198 194