Create directories so that path exists. Returns true if successful or if the directories already exist; returns false if unable to create directories for any reason.
| 8576 | // the directories already exist; returns false if unable to create directories |
| 8577 | // for any reason. |
| 8578 | bool FilePath::CreateDirectoriesRecursively() const { |
| 8579 | if (!this->IsDirectory()) { |
| 8580 | return false; |
| 8581 | } |
| 8582 | |
| 8583 | if (pathname_.length() == 0 || this->DirectoryExists()) { |
| 8584 | return true; |
| 8585 | } |
| 8586 | |
| 8587 | const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName()); |
| 8588 | return parent.CreateDirectoriesRecursively() && this->CreateFolder(); |
| 8589 | } |
| 8590 | |
| 8591 | // Create the directory so that path exists. Returns true if successful or |
| 8592 | // if the directory already exists; returns false if unable to create the |
no test coverage detected