--- parser3/src/main/pa_dir.C 2017/02/06 16:17:12 1.28 +++ parser3/src/main/pa_dir.C 2026/09/18 20:08:37 1.35 @@ -1,8 +1,8 @@ /** @file Parser: directory scanning for different OS-es. - Copyright (c) 2000-2015 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2000-2026 Art. Lebedev Studio (https://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ #include "pa_common.h" @@ -10,7 +10,19 @@ #include "pa_request.h" #include "pa_convert_utf.h" -volatile const char * IDENT_PA_DIR_C="$Id: pa_dir.C,v 1.28 2017/02/06 16:17:12 moko Exp $" IDENT_PA_DIR_H; +volatile const char * IDENT_PA_DIR_C="$Id: pa_dir.C,v 1.35 2026/09/18 20:08:37 moko Exp $" IDENT_PA_DIR_H; + +#ifdef WIN32 +bool is_os_absolute_path(const String& path) { + return is_os_absolute_path(path.cstr()); +} + +bool is_os_absolute_path(const char* path) { + return path[0] && path[0]!=':' && path[1]==':' // DRIVE: (including drive-relative paths, for compatibility) + || path[0]=='\\' && path[1]=='\\' // UNC + || path[0]=='/' && path[1]=='/'; +} +#endif #ifdef _MSC_VER @@ -90,9 +102,8 @@ bool findnext(struct ffblk *_ffblk) { if(!entry) return true; - strncpy(_ffblk->ff_name, entry->d_name, sizeof(_ffblk->ff_name)-1); - _ffblk->ff_name[sizeof(_ffblk->ff_name)-1]=0; - + pa_strncpy(_ffblk->ff_name, entry->d_name, sizeof(_ffblk->ff_name)); + #ifdef HAVE_STRUCT_DIRENT_D_TYPE // http://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html _ffblk->_d_type=entry->d_type;