@@ -78,7 +78,7 @@ namespace kanzi
78
78
if (idx != std::string::npos) {
79
79
_path = path.substr (0 , idx + 1 );
80
80
_name = path.substr (idx + 1 );
81
- }
81
+ }
82
82
else {
83
83
_path = " " ;
84
84
_name = path;
@@ -100,7 +100,7 @@ namespace kanzi
100
100
};
101
101
102
102
103
- static inline void createFileList (std::string& target, std::vector<FileData>& files, const FileListConfig& cfg,
103
+ static inline void createFileList (std::string& target, std::vector<FileData>& files, const FileListConfig& cfg,
104
104
std::vector<std::string>& errors)
105
105
{
106
106
if (target.size () == 0 )
@@ -152,7 +152,7 @@ namespace kanzi
152
152
if (cfg._recursive ) {
153
153
if (target[target.size () - 1 ] != PATH_SEPARATOR)
154
154
target += PATH_SEPARATOR;
155
- }
155
+ }
156
156
else {
157
157
target.resize (target.size () - 1 );
158
158
}
@@ -191,7 +191,7 @@ namespace kanzi
191
191
if ((idx != std::string::npos) && (idx < fullpath.length () - 1 ) && (fullpath[idx + 1 ] == ' .' ))
192
192
continue ;
193
193
}
194
-
194
+
195
195
if ((cfg._ignoreLinks == false ) || (buffer.st_mode & S_IFMT) != S_IFLNK)
196
196
#if __cplusplus >= 201103L
197
197
files.emplace_back (fullpath, buffer.st_size , buffer.st_mtime );
@@ -203,10 +203,10 @@ namespace kanzi
203
203
if (cfg._ignoreDotFiles == true ) {
204
204
size_t idx = fullpath.rfind (PATH_SEPARATOR);
205
205
206
- if ((idx != std::string::npos) && (idx < fullpath.length () - 1 ) && (fullpath[idx + 1 ] == ' .' ))
206
+ if ((idx != std::string::npos) && (idx < fullpath.length () - 1 ) && (fullpath[idx + 1 ] == ' .' ))
207
207
continue ;
208
208
}
209
-
209
+
210
210
createFileList (fullpath, files, cfg, errors);
211
211
}
212
212
}
@@ -247,10 +247,14 @@ namespace kanzi
247
247
}
248
248
249
249
250
- static inline int mkdirAll (const std::string& path, mode_t mode = S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH | S_IXOTH) {
251
- #if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
250
+ #if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
251
+ static inline int mkdirAll (const std::string& path)
252
+ {
252
253
bool foundDrive = false ;
253
- #endif
254
+ #else
255
+ static inline int mkdirAll (const std::string& path, mode_t mode = S_IRWXU | S_IRWXG | S_IROTH | S_IWOTH | S_IXOTH)
256
+ {
257
+ #endif
254
258
255
259
int res = 0 ;
256
260
errno = 0 ;
@@ -264,34 +268,34 @@ namespace kanzi
264
268
if (curPath.length () == 0 )
265
269
continue ;
266
270
267
- #if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
271
+ #if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
268
272
// Skip if drive
269
273
if ((foundDrive == false ) && (curPath.length () == 2 ) && (curPath[1 ] == ' :' )) {
270
274
foundDrive = true ;
271
275
continue ;
272
276
}
273
- #endif
277
+ #endif
274
278
275
- #if defined(_MSC_VER)
279
+ #if defined(_MSC_VER)
276
280
res = _mkdir (curPath.c_str ());
277
- #elif defined(__MINGW32__)
281
+ #elif defined(__MINGW32__)
278
282
res = mkdir (curPath.c_str ());
279
- #else
283
+ #else
280
284
res = mkdir (curPath.c_str (), mode);
281
- #endif
285
+ #endif
282
286
if ((res != 0 ) && (errno != EEXIST))
283
287
return errno;
284
288
}
285
289
}
286
290
errno = 0 ;
287
291
288
- #if defined(_MSC_VER)
292
+ #if defined(_MSC_VER)
289
293
res = _mkdir (path.c_str ());
290
- #elif defined(__MINGW32__)
294
+ #elif defined(__MINGW32__)
291
295
res = mkdir (path.c_str ());
292
- #else
296
+ #else
293
297
res = mkdir (path.c_str (), mode);
294
- #endif
298
+ #endif
295
299
296
300
return (res == 0 ) ? 0 : errno;
297
301
}
0 commit comments