fixed a case where import would fail because of an attempt to copy an already existing file while overwrite is false

preferencesAboutTextFull
Clément Fauconnier 2 years ago
parent 836f0f2705
commit cb7538aacd
  1. 7
      src/frameworks/UBFileSystemUtils.cpp

@ -105,6 +105,11 @@ bool UBFileSystemUtils::copyFile(const QString &source, const QString &destinati
if (QFileInfo(normalizedDestination).isFile() && overwrite) {
QFile::remove(normalizedDestination);
}
else
{
if (!overwrite)
return true; // don't try to copy an existing file if overwrite is false
}
} else {
normalizedDestination = normalizedDestination.replace(QString("\\"), QString("/"));
int pos = normalizedDestination.lastIndexOf("/");
@ -300,7 +305,7 @@ bool UBFileSystemUtils::copyDir(const QString& pSourceDirPath, const QString& pT
{
if (dirContent.isDir())
{
successSoFar = copyDir(pSourceDirPath + "/" + dirContent.fileName(), pTargetDirPath + "/" + dirContent.fileName());
successSoFar = copyDir(pSourceDirPath + "/" + dirContent.fileName(), pTargetDirPath + "/" + dirContent.fileName(), overwite);
}
else
{

Loading…
Cancel
Save