From d7891cc0f190ad67240a9baf22b248e9de0819f8 Mon Sep 17 00:00:00 2001
From: Gabriel Maia <gbl08ma@gmail.com>
Date: Tue, 6 Sep 2016 16:16:18 +0000
Subject: [PATCH] Screenshot: create destination folder if it doesn't exist
This ensures the artwork folder is created if it doesn't exist,
fixing the remainder of #10928.
---
src/apps/screenshot/ScreenshotWindow.cpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/apps/screenshot/ScreenshotWindow.cpp b/src/apps/screenshot/ScreenshotWindow.cpp
index ec70bdf..58a6df3 100644
a
|
b
|
ScreenshotWindow::_SaveScreenshot()
|
619 | 619 | if (path == NULL) |
620 | 620 | return B_ERROR; |
621 | 621 | |
| 622 | BEntry directoryEntry; |
| 623 | directoryEntry.SetTo(path.Path()); |
| 624 | |
| 625 | // create folder if it doesn't exist |
| 626 | // necessary, for example, when the user selects the Artwork folder from |
| 627 | // the list of predefined folders. |
| 628 | if (!directoryEntry.Exists()) { |
| 629 | if (create_directory(path.Path(), 0755) != B_OK) { |
| 630 | return B_ERROR; |
| 631 | } |
| 632 | } else if (!directoryEntry.IsDirectory()) { |
| 633 | // the entry exists but is not a directory. |
| 634 | // not much we can do |
| 635 | return B_ERROR; |
| 636 | } |
| 637 | |
622 | 638 | path.Append(fNameControl->Text()); |
623 | 639 | |
624 | 640 | BEntry entry; |