Commit 70b97c12 authored by Jeremy Whiting's avatar Jeremy Whiting
Browse files

Also use mkpath to make sure destination exists.

Before trying to move files, make sure the path we are trying
to move it to exists. If unable to create it, don't try to move the
files.
Also use mkpath to make sure destination exists.

(cherry picked from commit 928694d3)
parent 63c8f7c5
Pipeline #237315 passed with stage
in 2 minutes and 57 seconds
......@@ -192,7 +192,14 @@ void SharedKvtmlFiles::sortDownloadedFiles()
// move khangman files into
while ( !khangmanFiles.isEmpty() ) {
QUrl fileUrl( QUrl::fromLocalFile( khangmanFiles.first() ) );
QUrl destUrl = QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/khangman/data/" + fileUrl.fileName());
QUrl destDir = QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + "/khangman/data/");
QUrl destUrl = QUrl::fromLocalFile(destDir.toString() + fileUrl.fileName());
QDir dir;
if (!dir.mkpath(destDir.toLocalFile())) {
// Unable to create destination path, so skip
continue;
}
// do this better with KStandardDirs stuff
bool worked = QFile(fileUrl.toLocalFile()).rename(destUrl.toLocalFile());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment