|
From: Emilien K. <cur...@us...> - 2005-08-12 09:26:13
|
Update of /cvsroot/wxdevcenter/wxDevCenter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16859/src Modified Files: Plugin.cpp Log Message: Modify module loading process. Decorate name with "lib .so" or ".dll" Now correctly load them. Index: Plugin.cpp =================================================================== RCS file: /cvsroot/wxdevcenter/wxDevCenter/src/Plugin.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Plugin.cpp 11 Aug 2005 16:19:25 -0000 1.7 --- Plugin.cpp 12 Aug 2005 09:25:19 -0000 1.8 *************** *** 58,75 **** // Charge le module. ! bool ModuleRefData::Load(wxString strPath) { ! wxLogDebug(wxT("Loading module %s"), strPath.GetData()); ! ! BaseElementManager* pOldBEM = Element::s_pElementManager; ! Element::s_pElementManager = &m_Elements; ! ! m_strPath = strPath; ! ! bool flag = m_DLL.Load(strPath, wxDL_VERBATIM); ! Element::s_pElementManager = pOldBEM; ! return flag; } --- 58,95 ---- // Charge le module. ! bool ModuleRefData::Load(wxString strLongName) { ! wxString strFileName; ! ! /** Validate name.*/ ! strFileName = strLongName.AfterLast('/'); ! strLongName = strLongName.BeforeLast('/'); ! m_strPath = strLongName + wxT("/") + m_DLL.CanonicalizeName(strFileName); ! /** Find the good direcotry.*/ ! long l=0; ! wxString strPath; ! while(strPath = Application::GetApp().GetConfig().GetPluginsPath(), !strPath.IsEmpty()) ! { ! strPath += wxT("/") + m_strPath; ! if(wxFile::Exists(strPath)) ! { ! m_strPath = strPath; ! ! wxLogDebug(wxT("Loading module %s"), m_strPath.GetData()); ! BaseElementManager* pOldBEM = Element::s_pElementManager; ! Element::s_pElementManager = &m_Elements; ! bool flag = m_DLL.Load(strPath, wxDL_VERBATIM); ! Element::s_pElementManager = pOldBEM; ! if(flag) ! wxLogDebug(wxT("Module %s loaded"), strLongName.GetData()); ! else ! wxLogDebug(wxT("Module %s loading error"), strLongName.GetData()); ! return flag; ! } ! } ! wxLogDebug(wxT("Module %s not found"), strLongName.GetData()); ! return false; } *************** *** 220,241 **** bool Plugin::PreLoad(wxString strName) { ! wxString strFilePath = Application::GetApp().GetConfig().GetPluginsPath() + wxT("/") + strName + wxT("/plugin.xml"); ! PluginDescriptionFile File(strFilePath); ! if(File.IsValid()) ! { ! m_strName = File.GetName(); ! m_strDescript = File.GetDescript(); ! m_Version = File.GetVersion(); ! m_strAuthor = File.GetAuthor(); ! m_strLicence = File.GetLicence(); ! m_strNotes = File.GetNotes(); ! m_strURL = File.GetURL(); ! File.FillModuleArray(m_arrstrModules); ! File.FillDependantPluginArray(m_arrstrPlugins); ! m_Status = PreLoaded; ! return true; ! } m_Status = ErrDescript; ! wxLogDebug("Invalid feature description file"); return false; } --- 240,270 ---- bool Plugin::PreLoad(wxString strName) { ! long l=0; ! wxString strFilePath; ! ! while(strFilePath = Application::GetApp().GetConfig().GetPluginsPath(l++), !strFilePath.IsEmpty()) ! { ! strFilePath << wxT("/") << strName << wxT("/plugin.xml"); ! PluginDescriptionFile File(strFilePath); ! wxLogDebug(wxT(" - %s tested"), strFilePath.GetData()); ! if(File.IsValid()) ! { ! wxLogDebug(wxT(" - %s loaded"), strFilePath.GetData()); ! SetDescriptorFilePath(strFilePath); ! m_strName = File.GetName(); ! m_strDescript = File.GetDescript(); ! m_Version = File.GetVersion(); ! m_strAuthor = File.GetAuthor(); ! m_strLicence = File.GetLicence(); ! m_strNotes = File.GetNotes(); ! m_strURL = File.GetURL(); ! File.FillModuleArray(m_arrstrModules); ! File.FillDependantPluginArray(m_arrstrPlugins); ! m_Status = PreLoaded; ! return true; ! } ! } m_Status = ErrDescript; ! wxLogDebug(" - Invalid feature description file"); return false; } *************** *** 327,347 **** bool Feature::PreLoad(wxString strName) { ! wxString strFilePath = Application::GetApp().GetConfig().GetFeaturesPath() + wxT("/") + strName + wxT("/feature.xml"); ! FeatureDescriptionFile File(strFilePath); ! if(File.IsValid()) { ! m_strName = File.GetName(); ! m_strDescript = File.GetDescript(); ! m_Version = File.GetVersion(); ! m_strAuthor = File.GetAuthor(); ! m_strLicence = File.GetLicence(); ! m_strNotes = File.GetNotes(); ! m_strURL = File.GetURL(); ! File.FillDependantFeatureArray(m_arrstrFeatures); ! File.FillDependantPluginArray(m_arrstrPlugins); ! m_Status = PreLoaded; ! return true; } ! wxLogDebug("Invalid feature description file"); m_Status = ErrDescript; return false; --- 356,385 ---- bool Feature::PreLoad(wxString strName) { ! wxString strFilePath; ! long l; ! ! l=0; ! while(strFilePath = Application::GetApp().GetConfig().GetFeaturesPath(l++), !strFilePath.IsEmpty()) { ! strFilePath << wxT("/") << strName << wxT("/feature.xml"); ! FeatureDescriptionFile File(strFilePath); ! if(File.IsValid()) ! { ! wxLogDebug(wxT(" - %s loaded"), strFilePath.GetData()); ! SetDescriptorFilePath(strFilePath); ! m_strName = File.GetName(); ! m_strDescript = File.GetDescript(); ! m_Version = File.GetVersion(); ! m_strAuthor = File.GetAuthor(); ! m_strLicence = File.GetLicence(); ! m_strNotes = File.GetNotes(); ! m_strURL = File.GetURL(); ! File.FillDependantFeatureArray(m_arrstrFeatures); ! File.FillDependantPluginArray(m_arrstrPlugins); ! m_Status = PreLoaded; ! return true; ! } } ! wxLogDebug(" - No description file found"); m_Status = ErrDescript; return false; *************** *** 445,449 **** wxDir dir; ! wxLogDebug("Preload feature descriptions :"); l = 0; while(strPath=Application::GetApp().GetConfig().GetFeaturesPath(l++), !strPath.IsEmpty()) --- 483,487 ---- wxDir dir; ! wxLogDebug(wxT("Preload feature descriptions :")); l = 0; while(strPath=Application::GetApp().GetConfig().GetFeaturesPath(l++), !strPath.IsEmpty()) *************** *** 454,458 **** while(bCont) { ! wxLogDebug(wxT(" -> %s"), str.GetData()); PreLoadFeature(str); bCont = dir.GetNext(&str); --- 492,496 ---- while(bCont) { ! wxLogDebug(wxT(" Looking for %s"), str.GetData()); PreLoadFeature(str); bCont = dir.GetNext(&str); *************** *** 462,466 **** ! wxLogDebug("Preload plugin descriptions :"); l = 0; while(strPath=Application::GetApp().GetConfig().GetPluginsPath(l++), !strPath.IsEmpty()) --- 500,504 ---- ! wxLogDebug(wxT("Preload plugin descriptions :")); l = 0; while(strPath=Application::GetApp().GetConfig().GetPluginsPath(l++), !strPath.IsEmpty()) *************** *** 471,475 **** while(bCont) { ! wxLogDebug(wxT(" -> %s"), str.GetData()); PreLoadPlugin(str); bCont = dir.GetNext(&str); --- 509,513 ---- while(bCont) { ! wxLogDebug(wxT(" Looking for %s"), str.GetData()); PreLoadPlugin(str); bCont = dir.GetNext(&str); *************** *** 541,546 **** wxLogDebug(wxT("Loading module %s"), strPath.GetData()); - strPath.Prepend(Application::GetApp().GetConfig().GetPluginsPath() + wxT("/")); - Module& module = m_ModuleMap[strPath]; if(module.IsLoaded()) --- 579,582 ---- |