---------------------------------------------------------------------
| 152 | |
| 153 | //--------------------------------------------------------------------- |
| 154 | void CreateParentFolderIfNeeded(const std::filesystem::path& path) |
| 155 | { |
| 156 | if (path.has_parent_path()) |
| 157 | { |
| 158 | auto parentPath = path.parent_path(); |
| 159 | std::error_code er; |
| 160 | |
| 161 | std::filesystem::create_directories(parentPath, er); |
| 162 | if (er) |
| 163 | { |
| 164 | THROW(L"Error when creating folder " << parentPath.wstring() |
| 165 | << L" Error code:" << er.value()); |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | //--------------------------------------------------------------------- |
| 171 | bool FileExists(const std::filesystem::path& path) |