From 2556db1f849180c844575fa3aecdec34dfc5981c Mon Sep 17 00:00:00 2001 From: otavepto <153766569+otavepto@users.noreply.github.com> Date: Sat, 29 Jun 2024 06:50:46 +0300 Subject: [PATCH] use keyword `auto` for simplicity and avoiding false positive results when searching via ctrl+f --- dll/local_storage.cpp | 2 +- dll/steam_remote_storage.cpp | 4 ++-- helpers/common_helpers.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dll/local_storage.cpp b/dll/local_storage.cpp index 8ffe6531..42754300 100644 --- a/dll/local_storage.cpp +++ b/dll/local_storage.cpp @@ -617,7 +617,7 @@ std::vector Local_Storage::get_folders_path(std::string path) std::vector output{}; try { - const std::filesystem::path path_p(std::filesystem::u8path(path)); + const auto path_p(std::filesystem::u8path(path)); if (!common_helpers::dir_exist(path_p)) return output; for (const auto &dir_entry : diff --git a/dll/steam_remote_storage.cpp b/dll/steam_remote_storage.cpp index 79b92f98..04e148e3 100644 --- a/dll/steam_remote_storage.cpp +++ b/dll/steam_remote_storage.cpp @@ -33,11 +33,11 @@ static void copy_file(const std::string &src_filepath, const std::string &dst_fi try { PRINT_DEBUG("copying file '%s' to '%s'", src_filepath.c_str(), dst_filepath.c_str()); - const std::filesystem::path src_p(std::filesystem::u8path(src_filepath)); + const auto src_p(std::filesystem::u8path(src_filepath)); if (!common_helpers::file_exist(src_p)) return; - const std::filesystem::path dst_p(std::filesystem::u8path(dst_filepath)); + const auto dst_p(std::filesystem::u8path(dst_filepath)); std::filesystem::create_directories(dst_p.parent_path()); // make the folder tree if needed std::filesystem::copy_file(src_p, dst_p, std::filesystem::copy_options::overwrite_existing); } catch(...) {} diff --git a/helpers/common_helpers.cpp b/helpers/common_helpers.cpp index ee9a00df..e3f7f9c4 100644 --- a/helpers/common_helpers.cpp +++ b/helpers/common_helpers.cpp @@ -98,7 +98,7 @@ void KillableWorker::kill() } -static bool create_dir_impl(std::filesystem::path &dirpath) +static bool create_dir_impl(const std::filesystem::path &dirpath) { if (std::filesystem::is_directory(dirpath)) { @@ -114,13 +114,13 @@ static bool create_dir_impl(std::filesystem::path &dirpath) bool common_helpers::create_dir(std::string_view filepath) { - std::filesystem::path parent(std::filesystem::u8path(filepath).parent_path()); + const auto parent(std::filesystem::u8path(filepath).parent_path()); return create_dir_impl(parent); } bool common_helpers::create_dir(std::wstring_view filepath) { - std::filesystem::path parent(std::filesystem::path(filepath).parent_path()); + const auto parent(std::filesystem::path(filepath).parent_path()); return create_dir_impl(parent); }