--- parser3/src/main/pa_dir.C 2013/07/21 20:33:44 1.23 +++ parser3/src/main/pa_dir.C 2015/10/26 01:21:58 1.26 @@ -1,16 +1,16 @@ /** @file Parser: directory scanning for different OS-es. - Copyright (c) 2000-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2000-2015 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #include "pa_common.h" #include "pa_dir.h" -volatile const char * IDENT_PA_DIR_C="$Id: pa_dir.C,v 1.23 2013/07/21 20:33:44 moko Exp $" IDENT_PA_DIR_H; +volatile const char * IDENT_PA_DIR_C="$Id: pa_dir.C,v 1.26 2015/10/26 01:21:58 moko Exp $" IDENT_PA_DIR_H; -#ifdef WIN32 +#ifdef _MSC_VER #define TICKS_PER_SECOND 10000000ULL #define EPOCH_DIFFERENCE 11644473600ULL @@ -39,7 +39,7 @@ void findclose(struct ffblk *_ffblk) { FindClose(_ffblk->handle); } -bool ffblk::is_dir() { +bool ffblk::is_dir(bool) { return (ff_attrib & FILE_ATTRIBUTE_DIRECTORY) != 0; } @@ -93,11 +93,7 @@ void findclose(struct ffblk *_ffblk) { closedir(_ffblk->dir); } -#ifdef HAVE_STRUCT_DIRENT_D_TYPE void ffblk::stat_file() { -#else -void ffblk::real_stat_file() { -#endif char fileSpec[MAXPATH]; snprintf(fileSpec, MAXPATH, "%s/%s", filePath, ff_name); @@ -106,13 +102,13 @@ void ffblk::real_stat_file() { } } -bool ffblk::is_dir() { +bool ffblk::is_dir(bool stat) { #ifdef HAVE_STRUCT_DIRENT_D_TYPE - return (_d_type & DT_DIR) != 0; -#else - real_stat_file(); - return S_ISDIR(_st.st_mode) != 0; + if(!stat && _d_type != DT_UNKNOWN) + return _d_type == DT_DIR; #endif + stat_file(); + return S_ISDIR(_st.st_mode) != 0; } double ffblk::size() {