Commit f465f1a3 authored by Demitrius Belai's avatar Demitrius Belai Committed by Carl Schwan
Browse files

Fix directory creation on destination

When a file not exists on destination directory, Kompare needs to create it. However, Kompare creates a directory instead. 

CCBUG: 441131
CCBUG: 126870
parent c0ec97e0
Pipeline #149898 passed with stage
in 42 seconds
......@@ -388,14 +388,14 @@ bool KompareModelList::saveDestination(DiffModel* model)
qCDebug(LIBKOMPAREDIFF2) << "Tempfilename (save) : " << temp.fileName();
qCDebug(LIBKOMPAREDIFF2) << "Model->path+file : " << model->destinationPath() << model->destinationFile();
qCDebug(LIBKOMPAREDIFF2) << "info->localdest : " << m_info->localDestination;
QString tmp = model->destinationPath() + model->destinationFile();
QString tmp = model->destinationPath();
if (tmp.startsWith(m_info->localDestination)) // It should, if not serious trouble...
tmp.remove(0, m_info->localDestination.size());
qCDebug(LIBKOMPAREDIFF2) << "DestinationURL : " << m_info->destination;
qCDebug(LIBKOMPAREDIFF2) << "tmp : " << tmp;
KIO::UDSEntry entry;
QUrl fullDestinationPath = m_info->destination;
fullDestinationPath.setPath(fullDestinationPath.path() + QLatin1Char('/') + tmp);
fullDestinationPath.setPath(fullDestinationPath.path() + tmp);
qCDebug(LIBKOMPAREDIFF2) << "fullDestinationPath : " << fullDestinationPath;
KIO::StatJob* statJob = KIO::stat(fullDestinationPath);
if (!statJob->exec())
......@@ -408,6 +408,7 @@ bool KompareModelList::saveDestination(DiffModel* model)
return false;
}
}
fullDestinationPath.setPath(fullDestinationPath.path() + model->destinationFile());
KIO::FileCopyJob* copyJob = KIO::file_copy(QUrl::fromLocalFile(temp.fileName()), fullDestinationPath, -1, KIO::Overwrite);
result = copyJob->exec();
}
......
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