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.
| 9536 | // the directories already exist; returns false if unable to create directories |
| 9537 | // for any reason. |
| 9538 | bool FilePath::CreateDirectoriesRecursively() const { |
| 9539 | if (!this->IsDirectory()) { |
| 9540 | return false; |
| 9541 | } |
| 9542 | |
| 9543 | if (pathname_.length() == 0 || this->DirectoryExists()) { |
| 9544 | return true; |
| 9545 | } |
| 9546 | |
| 9547 | const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName()); |
| 9548 | return parent.CreateDirectoriesRecursively() && this->CreateFolder(); |
| 9549 | } |
| 9550 | |
| 9551 | // Create the directory so that path exists. Returns true if successful or |
| 9552 | // if the directory already exists; returns false if unable to create the |
no test coverage detected