--- parser3/src/include/pa_dir.h 2023/09/26 20:49:07 1.31 +++ parser3/src/include/pa_dir.h 2026/10/02 19:58:41 1.37 @@ -1,14 +1,14 @@ /** @file Parser: directory scanning for different OS-es decls. - Copyright (c) 2000-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2000-2026 Art. Lebedev Studio (https://www.artlebedev.com) Authors: Konstantin Morshnev , Alexandr Petrosian */ #ifndef PA_DIR_H #define PA_DIR_H -#define IDENT_PA_DIR_H "$Id: pa_dir.h,v 1.31 2023/09/26 20:49:07 moko Exp $" +#define IDENT_PA_DIR_H "$Id: pa_dir.h,v 1.37 2026/10/02 19:58:41 moko Exp $" #include "pa_config_includes.h" @@ -21,7 +21,7 @@ #include -#define MAXPATH MAX_PATH +#define MAXPATH ((MAX_PATH)*2) /*UTF-16*/ struct ffblk { struct _WIN32_FIND_DATAW stat; @@ -35,7 +35,7 @@ struct ffblk { time_t a_timestamp(); }; -#else +#else // _MSC_VER #define MAXPATH 1000 /*NAME_MAX*/ @@ -60,14 +60,14 @@ struct ffblk { time_t a_timestamp(); }; -#endif +#endif // _MSC_VER bool findfirst(const char* _pathname, struct ffblk *_ffblk, int _attrib); bool findnext(struct ffblk *_ffblk); void findclose(struct ffblk *_ffblk); -/// main dir workhorse: calles win32/unix unified functions findfirst/next/close [skip . and ..] -#define LOAD_DIR(dir,action) { \ +/// main dir workhorse: calls win32/unix unified functions findfirst/next/close [skip . and ..] +#define LOAD_DIR(dir,action,failure) { \ ffblk ffblk; \ if(!findfirst(dir, &ffblk, 0)) { \ do { \ @@ -77,7 +77,10 @@ void findclose(struct ffblk *_ffblk); } \ } while(!findnext(&ffblk)); \ findclose(&ffblk); \ + } else { \ + failure; \ } \ } + #endif