diff --git a/gpt4all-backend/dlhandle.h b/gpt4all-backend/dlhandle.h index c841b039..9b163dd6 100644 --- a/gpt4all-backend/dlhandle.h +++ b/gpt4all-backend/dlhandle.h @@ -54,6 +54,7 @@ public: }; #else #include +#include #include #include #ifndef NOMINMAX @@ -75,7 +76,9 @@ public: Dlhandle() : chandle(nullptr) {} Dlhandle(const std::string& fpath) { - chandle = LoadLibraryExA(fpath.c_str(), NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); + std::string path = fpath; + std::replace(path.begin(), path.end(), '/', '\\'); + chandle = LoadLibraryExA(path.c_str(), NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); if (!chandle) { throw Exception("dlopen(\""+fpath+"\"): Error"); } diff --git a/gpt4all-backend/llmodel.cpp b/gpt4all-backend/llmodel.cpp index 2431129f..c8079adc 100644 --- a/gpt4all-backend/llmodel.cpp +++ b/gpt4all-backend/llmodel.cpp @@ -104,7 +104,7 @@ const std::vector &LLModel::Implementation::implementat // Add to list if model implementation try { - Dlhandle dl(p.string()); + Dlhandle dl(std::filesystem::absolute(p).string()); if (!Implementation::isImplementation(dl)) { continue; }