mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
refactor: use std::filesystem::rename insted of copy and then moving.
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
3691f3a296
commit
c470f05abf
3 changed files with 25 additions and 14 deletions
|
|
@ -213,6 +213,22 @@ bool copy::operator()(const QString& offset, bool dryRun)
|
|||
return err.value() == 0;
|
||||
}
|
||||
|
||||
bool move(const QString& source, const QString& dest)
|
||||
{
|
||||
std::error_code err;
|
||||
|
||||
ensureFilePathExists(dest);
|
||||
fs::rename(StringUtils::toStdString(source), StringUtils::toStdString(dest), err);
|
||||
|
||||
if (err) {
|
||||
qWarning() << "Failed to move file:" << QString::fromStdString(err.message());
|
||||
qDebug() << "Source file:" << source;
|
||||
qDebug() << "Destination file:" << dest;
|
||||
}
|
||||
|
||||
return err.value() == 0;
|
||||
}
|
||||
|
||||
bool deletePath(QString path)
|
||||
{
|
||||
std::error_code err;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue