diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-04-10 04:18:14 -0500 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-04-10 04:18:14 -0500 |
| commit | 0b726b03d0d5c018004af438c8080f8d5ea7d432 (patch) | |
| tree | 378b027118692a9322840da5ffdbe4bbf3f24009 /libs | |
| parent | 7fafed9aab700f7cc39ef38cfcfc2efdb668289d (diff) | |
Fix backup restore failing when destination file already exists
QFile::copy() does not overwrite existing files, unlike Windows
SHFileOperation. Remove destination before copying to match the
expected overwrite behavior.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/uibase/src/utility.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libs/uibase/src/utility.cpp b/libs/uibase/src/utility.cpp index 94cbc77..c0070c6 100644 --- a/libs/uibase/src/utility.cpp +++ b/libs/uibase/src/utility.cpp @@ -152,6 +152,7 @@ static bool shellOpCopy(const QStringList& sourceNames, for (const auto& src : sourceNames) { QFileInfo srcInfo(src); QString dest = destinationNames[0] + "/" + srcInfo.fileName(); + QFile::remove(dest); if (!QFile::copy(src, dest)) { return false; } @@ -169,6 +170,7 @@ static bool shellOpCopy(const QStringList& sourceNames, if (!destInfo.dir().exists()) { destInfo.dir().mkpath("."); } + QFile::remove(destinationNames[i]); if (!QFile::copy(sourceNames[i], destinationNames[i])) { return false; } |
