| 807 | } |
| 808 | |
| 809 | bool PlatformFileSystem::mkdirs(PathId dirId) { |
| 810 | if (!dirId) return false; |
| 811 | |
| 812 | const std::filesystem::path dir = toPath(dirId); |
| 813 | if (dir.empty()) return false; |
| 814 | |
| 815 | std::error_code ec; |
| 816 | if ((std::filesystem::exists(dir, ec) && !ec) && |
| 817 | (std::filesystem::is_directory(dir, ec) && !ec)) { |
| 818 | return true; |
| 819 | } |
| 820 | |
| 821 | // CAUTION: There is a known bug in VC compiler where a trailing |
| 822 | // slash in the path will cause a false return from a call to |
| 823 | // fs::create_directories. |
| 824 | // if (!std::filesystem::create_directories(dir, ec) || ec) { |
| 825 | std::filesystem::create_directories(dir, ec); |
| 826 | if (ec) return false; |
| 827 | |
| 828 | return std::filesystem::is_directory(dir, ec) && !ec; |
| 829 | } |
| 830 | |
| 831 | bool PlatformFileSystem::rmtree(PathId dirId) { |
| 832 | if (!dirId) return false; |
no outgoing calls