From 8e39850558cf9a672f3732ef93287b2d37d14523 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Sat, 24 Aug 2024 16:17:10 -0500 Subject: [PATCH] updated build system --- .../librepertory/include/utils/file_utils.hpp | 3 --- .../src/providers/base_provider.cpp | 3 ++- .../librepertory/src/utils/file_utils.cpp | 21 ++++++------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/repertory/librepertory/include/utils/file_utils.hpp b/repertory/librepertory/include/utils/file_utils.hpp index 0f975e69..417874ec 100644 --- a/repertory/librepertory/include/utils/file_utils.hpp +++ b/repertory/librepertory/include/utils/file_utils.hpp @@ -31,9 +31,6 @@ void change_to_process_directory(); [[nodiscard]] auto copy_directory_recursively(std::string from_path, std::string to_path) -> bool; -[[nodiscard]] auto copy_file(std::string from_path, - std::string to_path) -> bool; - [[nodiscard]] auto get_directory_files(std::string path, bool oldest_first, bool recursive = false) -> std::deque; diff --git a/repertory/librepertory/src/providers/base_provider.cpp b/repertory/librepertory/src/providers/base_provider.cpp index ab0fbedc..db920767 100644 --- a/repertory/librepertory/src/providers/base_provider.cpp +++ b/repertory/librepertory/src/providers/base_provider.cpp @@ -495,7 +495,8 @@ void base_provider::remove_deleted_files() { event_system::instance().raise( item.source_path); if (utils::file::reset_modified_time(item.source_path) && - utils::file::copy_file(item.source_path, orphaned_file)) { + utils::file::file(item.source_path) + .copy_to(orphaned_file, true)) { event_system::instance().raise( item.source_path, orphaned_file); } else { diff --git a/repertory/librepertory/src/utils/file_utils.cpp b/repertory/librepertory/src/utils/file_utils.cpp index c32dfed8..1df56240 100644 --- a/repertory/librepertory/src/utils/file_utils.cpp +++ b/repertory/librepertory/src/utils/file_utils.cpp @@ -24,6 +24,7 @@ #include "types/repertory.hpp" #include "utils/collection.hpp" #include "utils/error_utils.hpp" +#include "utils/file.hpp" #include "utils/path.hpp" #include "utils/string.hpp" #include "utils/time.hpp" @@ -53,17 +54,6 @@ void change_to_process_directory() { #endif } -auto copy_file(std::string from_path, std::string to_path) -> bool { - from_path = utils::path::absolute(from_path); - to_path = utils::path::absolute(to_path); - if (utils::file::file(from_path).exists() && - not directory(to_path).exists()) { - return std::filesystem::copy_file(from_path, to_path); - } - - return false; -} - auto copy_directory_recursively(std::string from_path, std::string to_path) -> bool { from_path = utils::path::absolute(from_path); @@ -85,8 +75,9 @@ auto copy_directory_recursively(std::string from_path, utils::path::combine(to_path, {fd.cFileName})); } } else { - ret = copy_file(utils::path::combine(from_path, {fd.cFileName}), - utils::path::combine(to_path, {fd.cFileName})); + ret = + utils::file::file(utils::path::combine(from_path, {fd.cFileName})) + .copy_to(utils::path::combine(to_path, {fd.cFileName})); } } while (ret && (::FindNextFile(find, &fd) != 0)); @@ -105,8 +96,8 @@ auto copy_directory_recursively(std::string from_path, utils::path::combine(to_path, {de->d_name})); } } else { - ret = copy_file(utils::path::combine(from_path, {de->d_name}), - utils::path::combine(to_path, {de->d_name})); + ret = utils::file::file(utils::path::combine(from_path, {de->d_name})) + .copy_to(utils::path::combine(to_path, {de->d_name}), true); } }