| 683 | } |
| 684 | |
| 685 | bool File::pathExists(const char* path, bool considerFile) { |
| 686 | if (path == nullptr) { |
| 687 | return false; |
| 688 | } |
| 689 | #if ELPP_OS_UNIX |
| 690 | ELPP_UNUSED(considerFile); |
| 691 | struct stat st; |
| 692 | return (stat(path, &st) == 0); |
| 693 | #elif ELPP_OS_WINDOWS |
| 694 | DWORD fileType = GetFileAttributesA(path); |
| 695 | if (fileType == INVALID_FILE_ATTRIBUTES) { |
| 696 | return false; |
| 697 | } |
| 698 | return considerFile ? true : ((fileType & FILE_ATTRIBUTE_DIRECTORY) == 0 ? false : true); |
| 699 | #endif // ELPP_OS_UNIX |
| 700 | } |
| 701 | |
| 702 | bool File::createPath(const std::string& path) { |
| 703 | if (path.empty()) { |