MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / check_path

Function check_path

simcore/framework/src/cli/cli.hpp:2311–2333  ·  view source on GitHub ↗

get the type of the path from a file name

Source from the content-addressed store, hash-verified

2309#if defined CLI11_HAS_FILESYSTEM && CLI11_HAS_FILESYSTEM > 0
2310/// get the type of the path from a file name
2311inline 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
2336inline path_type check_path(const char *file) noexcept {

Callers 6

ExistingFileValidatorMethod · 0.85
ExistingPathValidatorMethod · 0.85
split_program_nameFunction · 0.85
_process_config_fileMethod · 0.85

Calls 2

statClass · 0.70
typeMethod · 0.45

Tested by

no test coverage detected