Menu

#61 std::filesystem::(weakly_)canonical excepts when using the path to ramdisk

open
nobody
None
2024-03-19
2024-03-19
No

I created the RAM disk using the tool.

When I try to use the std::filesystem::canonical or std::filesystem::weakly_canonical functions on paths pointing to RAM disk drive I get the exception:

#include <iostream>
#include <filesystem>

int main()
{
    std::filesystem::path path("R:/");
    try {
        std::cout << std::filesystem::weakly_canonical(path).generic_string() << std::endl;
    } catch (const std::filesystem::filesystem_error &fserr) {
        std::cout << fserr.code().message() << "(" << fserr.code().value() << "):" << fserr.what()
                  << std::endl;
    }
    return 0;
}

The output is following:

Incorrect function.(1):weakly_canonical: Incorrect function.: "R:/"

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.