LLM inference in C/C++
C++ ggml
common : remove fs_open_ifstream() by using u8path() (#29841)
Adrien Gallouët70849ee82c24
diff --git a/common/common.cpp b/common/common.cppindex 7ebfa26103..9c07dd84b8 100644--- a/common/common.cpp+++ b/common/common.cpp@@ -1071,18 +1071,6 @@ std::vector<common_file_info> fs_list(const std::string & path, bool include_dirreturn files;}-std::ifstream fs_open_ifstream(const std::string & fname, std::ios_base::openmode mode) {-#ifdef _WIN32- int wlen = MultiByteToWideChar(CP_UTF8, 0, fname.c_str(), -1, NULL, 0);- if (!wlen) { return std::ifstream(); }- std::vector<wchar_t> wfname(wlen);- (void)MultiByteToWideChar(CP_UTF8, 0, fname.c_str(), -1, wfname.data(), wlen);- return std::ifstream(wfname.data(), mode);-#else- return std::ifstream(fname, mode);-#endif-}-//// TTY utils//diff --git a/common/common.h b/common/common.hindex fd90c3b95b..49322c81b9 100644--- a/common/common.h+++ b/common/common.h@@ -935,9 +935,6 @@ struct common_file_info {};std::vector<common_file_info> fs_list(const std::string & path, bool include_directories);-// fs open, also handle UTF8 on Windows-std::ifstream fs_open_ifstream(const std::string & fname, std::ios_base::openmode mode);-void fs_write_atomic(const std::filesystem::path & path, const std::string & data);//diff --git a/tools/server/server-mcp.cpp b/tools/server/server-mcp.cppindex 88b2c92399..65e39179df 100644--- a/tools/server/server-mcp.cpp+++ b/tools/server/server-mcp.cpp@@ -689,7 +689,7 @@ void server_mcp::start(const common_params & params) {}};if (!params.mcp_servers_config.empty()) {- std::ifstream f = fs_open_ifstream(params.mcp_servers_config, std::ios::in);+ std::ifstream f(std::filesystem::u8path(params.mcp_servers_config), std::ios::in);if (!f) {throw std::runtime_error("failed to open MCP config file: " + params.mcp_servers_config);}