@@ -64,15 +64,17 @@ PluginManager::PluginManager() : ll::plugin::PluginManager(PluginManagerName) {}
6464ll::Expected<> PluginManager::load (ll::plugin::Manifest manifest) {
6565 auto & logger = getSelfPluginInstance ().getLogger ();
6666#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON
67- std::filesystem::path dirPath = ll::plugin::getPluginsRoot () / manifest.name ; // Plugin path
68- std::string entryPath = PythonHelper::findEntryScript (dirPath.string ()); // Plugin entry
67+ std::filesystem::path dirPath = ll::plugin::getPluginsRoot () / manifest.name ; // Plugin path
68+ std::string entryPath =
69+ PythonHelper::findEntryScript (ll::string_utils::u8str2str (dirPath.u8string ())); // Plugin entry
6970 // if (entryPath.empty()) return false;
7071 // std::string pluginName = PythonHelper::getPluginPackageName(dirPath.string()); // Plugin name
7172
7273 // Run "pip install" if needed
7374 auto realPackageInstallDir = (std::filesystem::path (dirPath) / " site-packages" ).make_preferred ();
7475 if (!std::filesystem::exists (realPackageInstallDir)) {
75- std::string dependTmpFilePath = PythonHelper::getPluginPackDependencyFilePath (dirPath.string ());
76+ std::string dependTmpFilePath =
77+ PythonHelper::getPluginPackDependencyFilePath (ll::string_utils::u8str2str (dirPath.u8string ()));
7678 if (!dependTmpFilePath.empty ()) {
7779 int exitCode = 0 ;
7880 lse::getSelfPluginInstance ().getLogger ().info (" llse.loader.python.executePipInstall.start" _tr (
@@ -103,13 +105,14 @@ ll::Expected<> PluginManager::load(ll::plugin::Manifest manifest) {
103105 // std::string pluginName = NodeJsHelper::getPluginPackageName(dirPath.string()); // Plugin name
104106
105107 // Run "npm install" if needed
106- if (NodeJsHelper::doesPluginPackHasDependency (dirPath.string ( ))
108+ if (NodeJsHelper::doesPluginPackHasDependency (ll::string_utils::u8str2str ( dirPath.u8string () ))
107109 && !std::filesystem::exists (std::filesystem::path (dirPath) / " node_modules" )) {
108110 int exitCode = 0 ;
109111 lse::getSelfPluginInstance ().getLogger ().info (" llse.loader.nodejs.executeNpmInstall.start" _tr (
110112 fmt::arg (" name" , ll::string_utils::u8str2str (dirPath.filename ().u8string ()))
111113 ));
112- if ((exitCode = NodeJsHelper::executeNpmCommand (" npm install" , dirPath.string ())) == 0 )
114+ if ((exitCode = NodeJsHelper::executeNpmCommand (" npm install" , ll::string_utils::u8str2str (dirPath.u8string ())))
115+ == 0 )
113116 lse::getSelfPluginInstance ().getLogger ().info (" llse.loader.nodejs.executeNpmInstall.success" _tr ());
114117 else
115118 lse::getSelfPluginInstance ().getLogger ().error (
@@ -173,14 +176,22 @@ ll::Expected<> PluginManager::load(ll::plugin::Manifest manifest) {
173176 // Load the plugin entry.
174177 auto pluginDir = std::filesystem::canonical (ll::plugin::getPluginsRoot () / manifest.name );
175178 auto entryPath = pluginDir / manifest.entry ;
176- ENGINE_OWN_DATA ()->pluginFileOrDirPath = entryPath.string ( );
179+ ENGINE_OWN_DATA ()->pluginFileOrDirPath = ll::string_utils::u8str2str ( entryPath.u8string () );
177180#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON
178- if (!PythonHelper::loadPluginCode (&scriptEngine, entryPath.string (), dirPath.string ())) {
181+ if (!PythonHelper::loadPluginCode (
182+ &scriptEngine,
183+ ll::string_utils::u8str2str (entryPath.u8string ()),
184+ ll::string_utils::u8str2str (dirPath.u8string ())
185+ )) {
179186 return ll::makeStringError (fmt::format (" failed to load plugin code" ));
180187 }
181188#endif
182189#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS
183- if (!NodeJsHelper::loadPluginCode (&scriptEngine, entryPath.string (), dirPath.string ())) {
190+ if (!NodeJsHelper::loadPluginCode (
191+ &scriptEngine,
192+ ll::string_utils::u8str2str (entryPath.u8string ()),
193+ ll::string_utils::u8str2str (dirPath.u8string ())
194+ )) {
184195 return ll::makeStringError (fmt::format (" failed to load plugin code" ));
185196 }
186197#endif
0 commit comments