|
|
| version 1.26, 2015/06/29 17:59:13 | version 1.30, 2020/12/15 17:10:31 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: directory scanning for different OS-es decls. | Parser: directory scanning for different OS-es decls. |
| Copyright (c) 2000-2012 Art. Lebedev Studio (http://www.artlebedev.com) | Copyright (c) 2000-2020 Art. Lebedev Studio (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| Line 24 | Line 24 |
| #define MAXPATH MAX_PATH | #define MAXPATH MAX_PATH |
| struct ffblk { | struct ffblk { |
| DWORD ff_attrib;/*dwFileAttributes;*/ | struct _WIN32_FIND_DATAW stat; |
| FILETIME ftCreationTime; | |
| FILETIME ftLastAccessTime; | |
| FILETIME ftLastWriteTime; | |
| DWORD nFileSizeHigh; | |
| DWORD nFileSizeLow; | |
| DWORD dwReserved0; | |
| DWORD dwReserved1; | |
| CHAR ff_name[ MAX_PATH ];/*cFileName[ MAX_PATH ];*/ | |
| CHAR cAlternateFileName[ 14 ]; | |
| /*helper*/ | |
| HANDLE handle; | HANDLE handle; |
| const char *name(); | |
| bool is_dir(bool); | bool is_dir(bool); |
| double size(); | double size(); |
| time_t c_timestamp(); | time_t c_timestamp(); |
| Line 50 struct ffblk { | Line 41 struct ffblk { |
| struct ffblk { | struct ffblk { |
| /*as if in windows :)*/ | /*as if in windows :)*/ |
| char ff_name[ MAXPATH ]; | char ff_name[ MAXPATH ]; |
| /*helpers*/ | /*helpers*/ |
| DIR *dir; | DIR *dir; |
| const char *filePath; | const char *filePath; |
| Line 59 struct ffblk { | Line 50 struct ffblk { |
| #ifdef HAVE_STRUCT_DIRENT_D_TYPE | #ifdef HAVE_STRUCT_DIRENT_D_TYPE |
| unsigned char _d_type; | unsigned char _d_type; |
| #endif | #endif |
| const char *name(){ return ff_name; } | |
| bool is_dir(bool); | bool is_dir(bool); |
| void stat_file(); | void stat_file(); |
| double size(); | double size(); |
| Line 74 bool findnext(struct ffblk *_ffblk); | Line 67 bool findnext(struct ffblk *_ffblk); |
| void findclose(struct ffblk *_ffblk); | void findclose(struct ffblk *_ffblk); |
| /// main dir workhorse: calles win32/unix unified functions findfirst/next/close [skip . and ..] | /// main dir workhorse: calles win32/unix unified functions findfirst/next/close [skip . and ..] |
| #define LOAD_DIR(dir,action) {\ | #define LOAD_DIR(dir,action) { \ |
| ffblk ffblk; \ | ffblk ffblk; \ |
| if(!findfirst(dir, &ffblk, 0)) { \ | if(!findfirst(dir, &ffblk, 0)) { \ |
| do \ | do { \ |
| if(*ffblk.ff_name && !(ffblk.ff_name[0]=='.' && (ffblk.ff_name[1]==0 || ffblk.ff_name[1]=='.' && ffblk.ff_name[2]==0) )) {\ | const char *file_name=ffblk.name(); \ |
| if(*file_name && !(file_name[0]=='.' && (file_name[1]==0 || file_name[1]=='.' && file_name[2]==0) )) { \ | |
| action; \ | action; \ |
| } \ | } \ |
| while(!findnext(&ffblk)); \ | } while(!findnext(&ffblk)); \ |
| findclose(&ffblk); \ | findclose(&ffblk); \ |
| } \ | } \ |
| } | } |
| #endif | #endif |