diff --git a/include/system.hpp b/include/system.hpp index c8809b97..34373664 100644 --- a/include/system.hpp +++ b/include/system.hpp @@ -36,6 +36,7 @@ Returns whether the rename was successful. */ bool rename(const std::string& srcPath, const std::string& destPath); /** Copies a file or directory recursively. +Overwrites destination if already exists. Returns whether the copy was successful. */ bool copy(const std::string& srcPath, const std::string& destPath); diff --git a/src/system.cpp b/src/system.cpp index f007bf35..5eb9fbdb 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -136,7 +136,7 @@ bool rename(const std::string& srcPath, const std::string& destPath) { bool copy(const std::string& srcPath, const std::string& destPath) { try { - fs::copy(fs::u8path(srcPath), fs::u8path(destPath), fs::copy_options::recursive); + fs::copy(fs::u8path(srcPath), fs::u8path(destPath), fs::copy_options::recursive | fs::copy_options::overwrite_existing); return true; } catch (fs::filesystem_error& e) {