MCPcopy Create free account
hub / github.com/Kitware/CMake / GetRealPathResolvingWindowsSubst

Method GetRealPathResolvingWindowsSubst

Source/cmSystemTools.cxx:1319–1348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1317}
1318
1319std::string cmSystemTools::GetRealPathResolvingWindowsSubst(
1320 std::string const& path, std::string* errorMessage)
1321{
1322#ifdef _WIN32
1323 // uv_fs_realpath uses Windows Vista API so fallback to kwsys if not found
1324 std::string resolved_path;
1325 uv_fs_t req;
1326 int err = uv_fs_realpath(nullptr, &req, path.c_str(), nullptr);
1327 if (!err) {
1328 resolved_path = std::string((char*)req.ptr);
1329 cmSystemTools::ConvertToUnixSlashes(resolved_path);
1330 } else if (err == UV_ENOSYS) {
1331 resolved_path = cmsys::SystemTools::GetRealPath(path, errorMessage);
1332 } else if (errorMessage) {
1333 cmsys::Status status =
1334 cmsys::Status::Windows(uv_fs_get_system_error(&req));
1335 *errorMessage = status.GetString();
1336 resolved_path.clear();
1337 } else {
1338 resolved_path = path;
1339 }
1340 // Normalize to upper-case drive letter as cm::PathResolver does.
1341 if (resolved_path.size() > 1 && resolved_path[1] == ':') {
1342 resolved_path[0] = cmsysString_toupper(resolved_path[0]);
1343 }
1344 return resolved_path;
1345#else
1346 return cmsys::SystemTools::GetRealPath(path, errorMessage);
1347#endif
1348}
1349
1350std::string cmSystemTools::GetRealPath(std::string const& path,
1351 std::string* errorMessage)

Callers

nothing calls this directly

Calls 7

GetRealPathFunction · 0.85
c_strMethod · 0.80
uv_fs_realpathFunction · 0.50
uv_fs_get_system_errorFunction · 0.50
GetStringMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected