From f2dbe9c087ac8776cd41f747a8b0ddf448c8399a Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Mon, 1 Dec 2025 14:20:43 +0100 Subject: [PATCH] rm unused fn --- tools/server/server-models.cpp | 50 +--------------------------------- 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/tools/server/server-models.cpp b/tools/server/server-models.cpp index 2b6505c410..09e4a3c244 100644 --- a/tools/server/server-models.cpp +++ b/tools/server/server-models.cpp @@ -3,7 +3,7 @@ #include "download.h" -#include +#include // TODO: remove this once we use HTTP client from download.h #include #include @@ -23,55 +23,8 @@ #include #endif -#if defined(__APPLE__) && defined(__MACH__) -// macOS: use _NSGetExecutablePath to get the executable path -#include -#include -#endif - #define CMD_EXIT "exit" -static std::filesystem::path get_server_exec_path() { -#if defined(_WIN32) - wchar_t buf[32768] = { 0 }; // Large buffer to handle long paths - DWORD len = GetModuleFileNameW(nullptr, buf, _countof(buf)); - if (len == 0 || len >= _countof(buf)) { - throw std::runtime_error("GetModuleFileNameW failed or path too long"); - } - return std::filesystem::path(buf); -#elif defined(__APPLE__) && defined(__MACH__) - char small_path[PATH_MAX]; - uint32_t size = sizeof(small_path); - - if (_NSGetExecutablePath(small_path, &size) == 0) { - // resolve any symlinks to get absolute path - try { - return std::filesystem::canonical(std::filesystem::path(small_path)); - } catch (...) { - return std::filesystem::path(small_path); - } - } else { - // buffer was too small, allocate required size and call again - std::vector buf(size); - if (_NSGetExecutablePath(buf.data(), &size) == 0) { - try { - return std::filesystem::canonical(std::filesystem::path(buf.data())); - } catch (...) { - return std::filesystem::path(buf.data()); - } - } - throw std::runtime_error("_NSGetExecutablePath failed after buffer resize"); - } -#else - char path[FILENAME_MAX]; - ssize_t count = readlink("/proc/self/exe", path, FILENAME_MAX); - if (count <= 0) { - throw std::runtime_error("failed to resolve /proc/self/exe"); - } - return std::filesystem::path(std::string(path, count)); -#endif -} - struct local_model { std::string name; std::string path; @@ -364,7 +317,6 @@ void server_models::load(const std::string & name, bool auto_load) { inst.subproc = std::make_shared(); { - //std::string exec_path = get_server_exec_path().string(); SRV_INF("spawning server instance with name=%s on port %d\n", inst.meta.name.c_str(), inst.meta.port); std::vector child_args;