Commit 22aeab58 authored by Ananta Palani's avatar Ananta Palani
Browse files

Allow file rename to replace existing file because rename() on Windows is not...

Allow file rename to replace existing file because rename() on Windows is not POSIX compatible and will not replace existing files.
parent 406ece93
......@@ -526,7 +526,11 @@ void BatchDialog::processed(const KUrl& url, const QString& tmpFile)
}
}
#ifndef Q_OS_WIN
if (::rename(QFile::encodeName(tmpFile), QFile::encodeName(destFile)) != 0)
#else
if (::MoveFileEx(tmpFile.utf16(), destFile.utf16(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) == 0)
#endif
{
item->setStatus(QString("Failed to save image."));
d->listView->processed(url, false);
......
......@@ -465,7 +465,11 @@ void SingleDialog::processed(const KUrl& url, const QString& tmpFile)
}
}
#ifndef Q_OS_WIN
if (::rename(QFile::encodeName(tmpFile), QFile::encodeName(destFile)) != 0)
#else
if (::MoveFileEx(tmpFile.utf16(), destFile.utf16(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) == 0)
#endif
{
KMessageBox::error(this, i18n("Failed to save image %1", destFile));
}
......
Markdown is supported
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