From de3cfddad0ac023b3647e43aff1afe98a13e91eb Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Thu, 5 Sep 2024 10:50:33 +0700 Subject: [PATCH] fix: clean --- engine/commands/cortex_upd_cmd.cc | 16 ++++++++++------ engine/utils/file_manager_utils.h | 6 +++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/engine/commands/cortex_upd_cmd.cc b/engine/commands/cortex_upd_cmd.cc index c05ecea16..a37832c07 100644 --- a/engine/commands/cortex_upd_cmd.cc +++ b/engine/commands/cortex_upd_cmd.cc @@ -13,10 +13,14 @@ #endif namespace commands { + +namespace { + const std::string kCortexBinary = "cortex-cpp"; +} + CortexUpdCmd::CortexUpdCmd() {} void CortexUpdCmd::Exec() { - std::cout << "1" << std::endl; // Check if the architecture and OS are supported auto system_info = system_info_utils::GetSystemInfo(); if (system_info.arch == system_info_utils::kUnsupported || @@ -122,19 +126,19 @@ void CortexUpdCmd::Exec() { return; } #if defined(_WIN32) - std::string temp = ".\\cortex-cpp_tmp.exe"; + std::string temp = ".\\cortex_tmp.exe"; remove(temp.c_str()); // ignore return code - std::string src = ".\\misc\\cortex-cpp\\cortex-cpp.exe"; - std::string dst = ".\\cortex-cpp.exe"; + std::string src = ".\\Cortex\\" + kCortexBinary + "\\" + kCortexBinary + ".exe"; + std::string dst = ".\\" + kCortexBinary + ".exe"; // Rename rename(dst.c_str(), temp.c_str()); // Update CopyFile(const_cast(src.c_str()), const_cast(dst.c_str()), false); #else - std::string src = "./misc/cortex-cpp/cortex-cpp"; - std::string dst = "./cortex-cpp"; + std::string src = "./Cortex/" + kCortexBinary + "/" + kCortexBinary; + std::string dst = "./" + kCortexBinary; std::filesystem::copy_file(src, dst, std::filesystem::copy_options::overwrite_existing); #endif diff --git a/engine/utils/file_manager_utils.h b/engine/utils/file_manager_utils.h index a3c2d39c6..740ad63be 100644 --- a/engine/utils/file_manager_utils.h +++ b/engine/utils/file_manager_utils.h @@ -1,8 +1,8 @@ #pragma once -#include "logging_utils.h" #include #include #include +#include "logging_utils.h" #if defined(__APPLE__) && defined(__MACH__) #include @@ -61,6 +61,8 @@ inline std::filesystem::path GetContainerFolderPath( container_folder_path = current_path / "engines"; } else if (type == "CudaToolkit") { container_folder_path = current_path; + } else if (type == "Cortex") { + container_folder_path = current_path / "cortex"; } else { container_folder_path = current_path / "misc"; } @@ -83,6 +85,8 @@ inline std::string downloadTypeToString(DownloadType type) { return "Misc"; case DownloadType::CudaToolkit: return "CudaToolkit"; + case DownloadType::Cortex: + return "Cortex"; default: return "UNKNOWN"; }