get the type of the path from a file name
| 2309 | #if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0 |
| 2310 | /// get the type of the path from a file name |
| 2311 | inline path_type check_path(const char *file) noexcept { |
| 2312 | std::error_code ec; |
| 2313 | auto stat = std::filesystem::status(file, ec); |
| 2314 | if (ec) { |
| 2315 | return path_type::nonexistent; |
| 2316 | } |
| 2317 | switch (stat.type()) { |
| 2318 | case std::filesystem::file_type::none: |
| 2319 | case std::filesystem::file_type::not_found: |
| 2320 | return path_type::nonexistent; |
| 2321 | case std::filesystem::file_type::directory: |
| 2322 | return path_type::directory; |
| 2323 | case std::filesystem::file_type::symlink: |
| 2324 | case std::filesystem::file_type::block: |
| 2325 | case std::filesystem::file_type::character: |
| 2326 | case std::filesystem::file_type::fifo: |
| 2327 | case std::filesystem::file_type::socket: |
| 2328 | case std::filesystem::file_type::regular: |
| 2329 | case std::filesystem::file_type::unknown: |
| 2330 | default: |
| 2331 | return path_type::file; |
| 2332 | } |
| 2333 | } |
| 2334 | #else |
| 2335 | /// get the type of the path from a file name |
| 2336 | inline path_type check_path(const char *file) noexcept { |
no test coverage detected