Function mrpt::system::toAbsolutePath

Function Documentation

std::string mrpt::system::toAbsolutePath(const std::string &path, bool resolveToCanonical = false)

Portable version of std::filesystem::absolute() and canonical()

If canonical==true relative paths, symlinks, etc. will be resolved too, but an exception will be thrown if the referenced file/path does not exist. If canonical==true, an absolute path will be always returned, even if does not actually exist.

mrpt::system::toAbsolutePath("/home/joe"); // -> "/home/joe"
mrpt::system::toAbsolutePath("../mary"); // -> "/home/mary"

Note

(New in MRPT 2.5.0)