Im trying to create all folder in a path that reach to a file, for that by a little search I found out about std::filesystem::create_directories
its ok but the problem of using it is looks like its can't handle long paths with so many subfolders, for small path its working without any problem, but when I tested it with a path that have 14 subfolder and near 185 character it failed and give me the The filename or extension is too long.
error
here is the code Im using so far:
void create_dirs(std::filesystem::path path)
{
if (!std::filesystem::exists(path))
{
path.remove_filename(); // remove file name
try
{
std::filesystem::create_directories(path); // create dirs
}
catch (std::filesystem::filesystem_error& e)
{
std::cerr << e.what() << std::endl;
}
}
}
so what can I do for this? and what is the best solution?
My OS: Windows