* Ignores exceptions thrown by create_directories if the requested directory exists. * Specifically handles case where path p exists, but it wasn't possible for the user to * write to the parent directory. */
| 272 | * write to the parent directory. |
| 273 | */ |
| 274 | bool TryCreateDirectories(const fs::path& p) |
| 275 | { |
| 276 | try { |
| 277 | return fs::create_directories(p); |
| 278 | } catch (const fs::filesystem_error&) { |
| 279 | if (!fs::exists(p) || !fs::is_directory(p)) |
| 280 | throw; |
| 281 | } |
| 282 | |
| 283 | // create_directories didn't create the directory, it had to have existed already |
| 284 | return false; |
| 285 | } |
| 286 | |
| 287 | std::string PermsToSymbolicString(fs::perms p) |
| 288 | { |