chore(remove FS::copyFile):

Now that #333 is merged and FS::copy works on non directory copyFile can be removed.

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2022-11-01 04:28:57 -07:00
parent a7a331a26e
commit 6010ce0dc5
4 changed files with 2 additions and 31 deletions

View File

@ -163,32 +163,6 @@ bool ensureFolderPathExists(QString foldernamepath)
return success; return success;
} }
/// @brief Copy file at src to dest, ensures the full filepath exsists
/// @param src srouce file path
/// @param dst destination file path
/// @return boolean: was there an error during the filecopy?
bool copyFile(QString const& src, QString const& dst) {
using copy_opts = fs::copy_options;
std::error_code err;
fs::copy_options opt = copy_opts::none;
// The default behavior is to follow symlinks
opt |= copy_opts::copy_symlinks;
ensureFilePathExists(dst);
fs::copy(toStdString(src), toStdString(dst), opt, err);
if (err) {
qWarning() << "Failed to copy files:" << QString::fromStdString(err.message());
qDebug() << "Source file:" << src;
qDebug() << "Destination file:" << dst;
}
return err.value() == 0;
}
/// @brief Copies a directory and it's contents from src to dest /// @brief Copies a directory and it's contents from src to dest
/// @param offset subdirectory form src to copy to dest /// @param offset subdirectory form src to copy to dest
/// @return if there was an error during the filecopy /// @return if there was an error during the filecopy

View File

@ -75,9 +75,6 @@ bool ensureFilePathExists(QString filenamepath);
*/ */
bool ensureFolderPathExists(QString filenamepath); bool ensureFolderPathExists(QString filenamepath);
// TODO: remove in favor of FS::copy once #333 is merged
bool copyFile(QString const& src, QString const& dst);
/// @brief Copies a directory and it's contents from src to dest /// @brief Copies a directory and it's contents from src to dest
class copy { class copy {
public: public:

View File

@ -433,7 +433,7 @@ void FlameCreationTask::copyBlockedMods(QList<BlockedMod> const& blocked_mods) {
qDebug() << "Will try to copy" << mod.localPath << "to" << dest_path; qDebug() << "Will try to copy" << mod.localPath << "to" << dest_path;
if (!FS::copyFile(mod.localPath, dest_path)) { // FIXME: use FS::copy once #333 is merged if (!FS::copy(mod.localPath, dest_path)()) {
qDebug() << "Copy of" << mod.localPath << "to" << dest_path << "Failed"; qDebug() << "Copy of" << mod.localPath << "to" << dest_path << "Failed";
} }

View File

@ -373,7 +373,7 @@ void PackInstallTask::copyBlockedMods() {
qDebug() << "Will try to copy" << mod->localPath << "to" << dest_path; qDebug() << "Will try to copy" << mod->localPath << "to" << dest_path;
if (!FS::copyFile(mod->localPath, dest_path)) { // FIXME: use FS::copy once #333 is merged if (!FS::copy(mod->localPath, dest_path)()) {
qDebug() << "Copy of" << mod->localPath << "to" << dest_path << "Failed"; qDebug() << "Copy of" << mod->localPath << "to" << dest_path << "Failed";
} }