dirent.h (1290B)
1 // Copyright (c) the JPEG XL Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef LIB_JXL_THIRD_PARTY_DIRENT_H_ 16 #define LIB_JXL_THIRD_PARTY_DIRENT_H_ 17 18 // Emulates POSIX readdir for Windows 19 20 #if defined(_WIN32) || defined(_WIN64) 21 22 #include <sys/stat.h> // S_IFREG 23 24 #ifndef _MODE_T_ 25 typedef unsigned int mode_t; 26 #endif // _MODE_T_ 27 int mkdir(const char* path, mode_t mode); 28 29 struct dirent { 30 char* d_name; // no path 31 }; 32 33 #define stat _stat64 34 35 #ifndef S_ISDIR 36 #define S_ISDIR(m) (m & S_IFDIR) 37 #endif // S_ISDIR 38 39 #ifndef S_ISREG 40 #define S_ISREG(m) (m & S_IFREG) 41 #endif // S_ISREG 42 43 struct DIR; 44 DIR* opendir(const char* path); 45 int closedir(DIR* dir); 46 dirent* readdir(DIR* d); 47 48 #endif // #if defined(_WIN32) || defined(_WIN64) 49 #endif // LIB_JXL_THIRD_PARTY_DIRENT_H_