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. Signed-off-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
584fd9619c
commit
c6b4e47a50
@@ -619,6 +619,22 @@ ScreenshotWindow::_SaveScreenshot()
|
|||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
|
BEntry directoryEntry;
|
||||||
|
directoryEntry.SetTo(path.Path());
|
||||||
|
|
||||||
|
// create folder if it doesn't exist
|
||||||
|
// necessary, for example, when the user selects the Artwork folder from
|
||||||
|
// the list of predefined folders.
|
||||||
|
if (!directoryEntry.Exists()) {
|
||||||
|
if (create_directory(path.Path(), 0755) != B_OK) {
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
} else if (!directoryEntry.IsDirectory()) {
|
||||||
|
// the entry exists but is not a directory.
|
||||||
|
// not much we can do
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
path.Append(fNameControl->Text());
|
path.Append(fNameControl->Text());
|
||||||
|
|
||||||
BEntry entry;
|
BEntry entry;
|
||||||
|
|||||||
Reference in New Issue
Block a user