From 8d5730f7153151426c0f205a862260fb1140e5fc Mon Sep 17 00:00:00 2001 From: peri4 Date: Sat, 30 Apr 2022 16:07:30 +0300 Subject: [PATCH] PIPluginLoader +1 error --- libs/main/core/piconstchars.h | 2 +- libs/main/system/piplugin.cpp | 9 ++++++++- libs/main/system/piplugin.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/main/core/piconstchars.h b/libs/main/core/piconstchars.h index ca684443..299ecabc 100644 --- a/libs/main/core/piconstchars.h +++ b/libs/main/core/piconstchars.h @@ -60,7 +60,7 @@ public: //! \~english Read-only access to character by `index`. //! \~russian Доступ на чтение к символу по индексу `index`. - inline const char & operator [](size_t index) const {return str[index];} + inline char operator [](size_t index) const {return str[index];} //! \~english Read-only access to character by `index`. //! \~russian Доступ на чтение к символу по индексу `index`. diff --git a/libs/main/system/piplugin.cpp b/libs/main/system/piplugin.cpp index e3fdf52b..a1d48b9b 100644 --- a/libs/main/system/piplugin.cpp +++ b/libs/main/system/piplugin.cpp @@ -342,7 +342,14 @@ bool PIPluginLoader::load(const PIString & name) { unload(); PIPluginInfo * ai = PIPluginInfoStorage::instance()->applicationInfo(); PIPluginInfo * pi = PIPluginInfoStorage::instance()->enterPlugin(this); - if (!lib.load(findLibrary(name))) { + PIString fname = findLibrary(name); + if (fname.isEmpty()) { + error = NoSuchFile; + error_str = "Load plugin \"" + lib.path() + "\" error: can`t find lib for \"" + name + "\""; + if (messages) piCout << error_str; + return false; + } + if (!lib.load(fname)) { unload(); error = LibraryLoadError; error_str = "Load plugin \"" + lib.path() + "\" error: can`t load lib: " + lib.lastError(); diff --git a/libs/main/system/piplugin.h b/libs/main/system/piplugin.h index e3eb8ee4..d746d7ac 100644 --- a/libs/main/system/piplugin.h +++ b/libs/main/system/piplugin.h @@ -166,6 +166,7 @@ public: enum Error { Unknown /** \~english No \a load() call yet \~russian Не было вызова \a load() */ , NoError /** \~english No error \~russian Нет ошибки */ , + NoSuchFile /** \~english Can`t find library file \~russian Не найден файл библиотеки */ , LibraryLoadError /** \~english System can`t load library \~russian Система не смогла загрузить библиотеку */ , MissingSymbols /** \~english Can`t find necessary symbols \~russian Нет необходимых методов */ , InvalidLoaderVersion /** \~english Internal version mismatch \~russian Неверная внутренняя версия */ ,