{
LogInfo("Plugin installation: step CheckPluginPath");
- struct stat tmp;
-
- if (-1 == stat(m_context->pluginFilePath.c_str(), &tmp)) {
+ if(!m_context->pluginFilePath.Exists()){
ThrowMsg(Exceptions::PluginPathFailed,
- "Stat function failed");
- }
-
- if (!S_ISDIR(tmp.st_mode)) {
- ThrowMsg(Exceptions::PluginPathFailed,
- "Invalid Directory");
+ "No such path");
}
SET_PLUGIN_INSTALL_PROGRESS(PLUGIN_PATH, "Path to plugin verified");
{
LogInfo("Plugin installation: step parse config file");
- struct stat tmp;
-
- std::string filename = m_context->pluginFilePath + DIRECTORY_SEPARATOR +
- std::string(GlobalConfig::GetPluginMetafileName());
+ DPL::Utils::Path filename = m_context->pluginFilePath;
+ filename /= GlobalConfig::GetPluginMetafileName();
- if (-1 == stat(filename.c_str(), &tmp)) {
+ if(!filename.Exists()){
m_dataFromConfigXML = false;
return;
}
- LogInfo("Plugin Config file::" << filename);
+ LogInfo("Plugin Config file::" << filename.Filename());
Try
{
}
Catch(ValidationCore::ParserSchemaException::Base)
{
- LogError("Error during file processing " << filename);
+ LogError("Error during file processing " << filename.Filename());
ThrowMsg(Exceptions::PluginMetafileFailed,
"Metafile error");
}
return;
}
LogDebug("Plugin installation: step find plugin library");
- std::string pluginPath = m_context->pluginFilePath;
- size_t indexpos = pluginPath.find_last_of('/');
+ DPL::Utils::Path pluginPath = m_context->pluginFilePath;
+ size_t indexpos = pluginPath.Fullpath().find_last_of('/');
if (std::string::npos == indexpos) {
indexpos = 0;
indexpos += 1; // move after '/'
}
- std::string libName = pluginPath.substr(indexpos);
+ std::string libName = pluginPath.Fullpath().substr(indexpos);
libName = GlobalConfig::GetPluginPrefix() + libName +
GlobalConfig::GetPluginSuffix();
LogDebug("Plugin .so: " << libName);
DISABLE_IF_PLUGIN_WITHOUT_LIB()
- std::string filename = m_context->pluginFilePath + DIRECTORY_SEPARATOR +
- m_pluginInfo.m_libraryName;
+ DPL::Utils::Path filename = m_context->pluginFilePath;
+ filename /= m_pluginInfo.m_libraryName;
- LogDebug("Loading plugin: " << filename);
+ LogDebug("Loading plugin: " << filename.Filename());
- void *dlHandle = dlopen(filename.c_str(), RTLD_LAZY);
+ void *dlHandle = dlopen(filename.Fullpath().c_str(), RTLD_LAZY);
if (dlHandle == NULL) {
const char* error = (const char*)dlerror();
LogError(
- "Failed to load plugin: " << filename <<
+ "Failed to load plugin: " << filename.Filename() <<
". Reason: " << (error != NULL ? error : "unknown"));
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
if (rawEntityList == NULL) {
dlclose(dlHandle);
- LogError("Failed to read class name" << filename);
+ LogError("Failed to read class name" << filename.Filename());
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
if (NULL == onWidgetInitProc) {
dlclose(dlHandle);
- LogError("Failed to read onWidgetInit symbol" << filename);
+ LogError("Failed to read onWidgetInit symbol" << filename.Filename());
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
const js_entity_definition_t *rawEntityListIterator = rawEntityList;
LogInfo("#####");
- LogInfo("##### Plugin: " << filename << " supports new plugin API");
+ LogInfo("##### Plugin: " << filename.Filename() << " supports new plugin API");
LogInfo("#####");
while (rawEntityListIterator->parent_name != NULL &&
LogInfo("Plugin installation: step register Plugin");
m_pluginHandle =
- PluginDAO::registerPlugin(m_pluginInfo, m_context->pluginFilePath);
+ PluginDAO::registerPlugin(m_pluginInfo, m_context->pluginFilePath.Fullpath());
SET_PLUGIN_INSTALL_PROGRESS(REGISTER_PLUGIN, "Plugin registered");
}