diff --git a/src/ll/api/data/KeyValueDB.cpp b/src/ll/api/data/KeyValueDB.cpp index 6d64f644aa..127e8958f0 100644 --- a/src/ll/api/data/KeyValueDB.cpp +++ b/src/ll/api/data/KeyValueDB.cpp @@ -91,7 +91,7 @@ KeyValueDB::KeyValueDB(std::filesystem::path const& path, bool createIfMiss, int std::error_code ec; std::filesystem::create_directories(path, ec); } - impl = std::make_unique(string_utils::wstr2str(path.native()), createIfMiss, bloomFilterBit); + impl = std::make_unique(string_utils::wstr2str(path.wstring()), createIfMiss, bloomFilterBit); } KeyValueDB::KeyValueDB(KeyValueDB&&) noexcept = default; diff --git a/src/ll/api/io/FileUtils.cpp b/src/ll/api/io/FileUtils.cpp index 5972e59b2a..735dcb0dff 100644 --- a/src/ll/api/io/FileUtils.cpp +++ b/src/ll/api/io/FileUtils.cpp @@ -80,7 +80,7 @@ data::Version getVersion(std::filesystem::path const& filePath) { data::Version version; ushort build_ver{}; uint flag{}; - if (!getFileVersion(filePath.native(), version.major, version.minor, version.patch, build_ver, flag)) { + if (!getFileVersion(filePath.wstring(), version.major, version.minor, version.patch, build_ver, flag)) { return {}; } else { version.preRelease = data::PreRelease{}; diff --git a/src/ll/core/plugin/NativePluginManager.cpp b/src/ll/core/plugin/NativePluginManager.cpp index 9599554d94..ee6c1d995d 100644 --- a/src/ll/core/plugin/NativePluginManager.cpp +++ b/src/ll/core/plugin/NativePluginManager.cpp @@ -13,7 +13,7 @@ NativePluginManager::NativePluginManager() : PluginManager(NativePluginManagerNa NativePluginManager::~NativePluginManager() = default; static void printDependencyError( - const std::unique_ptr& item, + std::unique_ptr const& item, std::ostream& stream, size_t depth = 0 ) { @@ -39,14 +39,14 @@ static void printDependencyError( } } if (!item->mDependencies.empty()) { - for (const auto& [module, subItem] : item->mDependencies) { + for (auto const& [module, subItem] : item->mDependencies) { printDependencyError(subItem, stream, depth + 1); } } } } -std::string diagnosticDependency(const std::filesystem::path& path) { +static std::string diagnosticDependency(std::filesystem::path const& path) { auto result = pl::dependency_walker::pl_diagnostic_dependency(path); std::stringstream stream; printDependencyError(result, stream); @@ -58,7 +58,19 @@ bool NativePluginManager::load(Manifest manifest) { if (hasPlugin(manifest.name)) { return false; } - auto entry = getPluginsRoot() / manifest.name / manifest.entry; + auto pluginDir = std::filesystem::canonical(getPluginsRoot() / manifest.name); + + std::wstring buffer(32767, '\0'); + + if (auto res = GetEnvironmentVariable(L"PATH", buffer.data(), 32767); res != 0 && res != 32767) { + buffer.resize(res); + if (!buffer.empty()) { + buffer += L";"; + } + buffer += pluginDir.wstring(); + SetEnvironmentVariable(L"PATH", buffer.c_str()); + } + auto entry = pluginDir / manifest.entry; auto lib = LoadLibrary(entry.c_str()); if (!lib) { auto e = error_utils::getWinLastError();