| 67 | } |
| 68 | |
| 69 | bool IsRegularFileUtf8(const std::string& path) { |
| 70 | #if defined(_WIN32) || defined(_WIN64) |
| 71 | const DWORD attributes = |
| 72 | GetFileAttributesW(internal::WideFromUtf8(path).c_str()); |
| 73 | return attributes != INVALID_FILE_ATTRIBUTES && |
| 74 | (attributes & FILE_ATTRIBUTE_DIRECTORY) == 0; |
| 75 | #else |
| 76 | struct stat info; |
| 77 | if (stat(path.c_str(), &info) != 0) { |
| 78 | return false; |
| 79 | } |
| 80 | return (info.st_mode & S_IFMT) == S_IFREG; |
| 81 | #endif |
| 82 | } |
| 83 | |
| 84 | std::string JoinPath(const std::string& root, const std::string& resource) { |
| 85 | if (root.empty()) { |
no test coverage detected