STDMETHODIMP CLibObject::CheckIn( /*[in, string]*/ BSTR sPOUName, /*[in, string]*/ BSTR sTargetType, /*[in, string]*/ BSTR sFileSpec, /*[out]*/ BSTR* sErrorDescr ) { HRESULT hr; FC_CArDir* pPOU; FC_CString fileSpec(MAX_PATH); FC_ARSTAT ret; *sErrorDescr = NULL; hr = getPouDir(sPOUName, sTargetType, &pPOU, sErrorDescr, true); if(hr != S_OK) { assert(hr != S_FALSE); return hr; } fileSpec.load(sFileSpec); ret = pPOU->createFilesFromDisk(fileSpec, false); return ret==FC_AR_OK ? S_OK : onArError(ret, sErrorDescr); }
void BIN_ProjectLoader::loadStageClipNames( const STD_String &projectFolder, StringCol_t &clipNames ) { // Todo, remove need for PL_FileSpec here! PL_FileSpec fileSpec( (projectFolder + "/stages").c_str() ); for ( PL_FileSpec::iterator i = fileSpec.begin(), iEnd = fileSpec.end() ; i!=iEnd ; ++i ) { clipNames.push_back( i->GetName( false /* no extension */ ).utf8() ); } }
static void setSourceFiles(LLDBPlugin* plugin, PDWriter* writer) { if (!plugin->hasValidTarget) return; PDWrite_event_begin(writer, PDEventType_SetSourceFiles); PDWrite_array_begin(writer, "files"); const uint32_t moduleCount = plugin->target.GetNumModules(); for (uint32_t im = 0; im < moduleCount; ++im) { lldb::SBModule module(plugin->target.GetModuleAtIndex(im)); const uint32_t compileUnitCount = module.GetNumCompileUnits(); for (uint32_t ic = 0; ic < compileUnitCount; ++ic) { lldb::SBCompileUnit compileUnit(module.GetCompileUnitAtIndex(ic)); const uint32_t supportFileCount = compileUnit.GetNumSupportFiles(); for (uint32_t is = 0; is < supportFileCount; ++is) { char filename[4096]; lldb::SBFileSpec fileSpec(compileUnit.GetSupportFileAtIndex(is)); filename[0] = 0; fileSpec.GetPath(filename, sizeof(filename)); if (filename[0] == 0) continue; PDWrite_array_entry_begin(writer); PDWrite_string(writer, "file", filename); PDWrite_entry_end(writer); } } } PDWrite_array_end(writer); PDWrite_event_end(writer); }
bool BIN_ProjectLoader::loadSpriteSheet( const STD_String &projectFolder, const STD_String &sheetName, const STD_String &resolutionName, RD_SpriteSheetCore *sheet ) { PL_FileSpec fileSpec( (projectFolder + "/spriteSheets/" + sheetName + "-" + resolutionName + ".bin").c_str() ); if ( !fileSpec.IsFile() ) { return false; } IO_File file; if ( !file.openForInput( fileSpec ) ) return false; IO_PersistentStore store(file); sheet->load( store ); file.close(); return true; }
bool BIN_ProjectLoader::loadStageClip( const STD_String &projectFolder, const STD_String &clipName, RD_ClipDataCore *clipData ) { // Todo, remove need for PL_FileSpec here! PL_FileSpec fileSpec( (projectFolder + "/stages/" + clipName + ".bin").c_str() ); if ( !fileSpec.IsFile() ) { return false; } IO_File file; if ( !file.openForInput( fileSpec ) ) return false; IO_PersistentStore store(file); clipData->load( store ); file.close(); return true; }
void BIN_ProjectLoader::loadSpriteSheetNames( const STD_String &projectFolder, StringPairCol_t &sheetNames ) { // Todo, remove need for PL_FileSpec here! PL_FileSpec fileSpec( (projectFolder + "/spriteSheets").c_str() ); for ( PL_FileSpec::iterator i = fileSpec.begin(), iEnd = fileSpec.end() ; i!=iEnd ; ++i ) { if ( i->GetExtension() == UT_String( "bin" ) ) { UT_String spriteSheetName = i->GetName( false /* no extension */ ); size_t idx = spriteSheetName.find ( "-" ); if ( idx != STD_String::npos ) { StringPair_t sheetName; sheetName.first = spriteSheetName.substr( 0, idx ).utf8(); sheetName.second = spriteSheetName.substr( idx+1 ).utf8(); sheetNames.push_back( sheetName ); } } } }
void PluginManager::Load() { wxString ext; #if defined(__WXGTK__) ext = wxT("so"); #elif defined(__WXMAC__) ext = wxT("dylib"); #else ext = wxT("dll"); #endif wxString fileSpec(wxT("*.") + ext); clConfig conf("plugins.conf"); conf.ReadItem(&m_pluginsData); // set the managers // this code assures us that the shared objects will see the same instances as the application // does LanguageST::Get()->SetTagsManager(GetTagsManager()); TagsManagerST::Get()->SetLanguage(LanguageST::Get()); // Plugin loading policy CodeLiteApp* app = static_cast<CodeLiteApp*>(GetTheApp()); CodeLiteApp::PluginPolicy pp = app->GetPluginLoadPolicy(); wxArrayString allowedPlugins; if(pp == CodeLiteApp::PP_None) { return; } else if(pp == CodeLiteApp::PP_FromList) allowedPlugins = app->GetAllowedPlugins(); wxString pluginsDir = clStandardPaths::Get().GetPluginsDirectory(); if(wxDir::Exists(pluginsDir)) { // get list of dlls wxArrayString files; wxDir::GetAllFiles(pluginsDir, &files, fileSpec, wxDIR_FILES); // Sort the plugins by A-Z std::sort(files.begin(), files.end()); for(size_t i = 0; i < files.GetCount(); i++) { wxString fileName(files.Item(i)); #if defined(__WXMSW__) && !defined(NDEBUG) // Under MSW loading a release plugin while in debug mode will cause a crash if(!fileName.EndsWith("-dbg.dll")) { continue; } #elif defined(__WXMSW__) // filter debug plugins if(fileName.EndsWith("-dbg.dll")) { continue; } #endif #ifdef __WXGTK__ wxFileName fnDLL(fileName); if(fnDLL.GetFullName().StartsWith("lib")) { // don't attempt to load a library continue; } #endif clDynamicLibrary* dl = new clDynamicLibrary(); if(!dl->Load(fileName)) { CL_ERROR(wxT("Failed to load plugin's dll: ") + fileName); if(!dl->GetError().IsEmpty()) { CL_ERROR(dl->GetError()); } continue; } bool success(false); GET_PLUGIN_INFO_FUNC pfnGetPluginInfo = (GET_PLUGIN_INFO_FUNC)dl->GetSymbol(wxT("GetPluginInfo"), &success); if(!success) { continue; } // load the plugin version method // if the methods does not exist, handle it as if it has value of 100 (lowest version API) int interface_version(100); GET_PLUGIN_INTERFACE_VERSION_FUNC pfnInterfaceVersion = (GET_PLUGIN_INTERFACE_VERSION_FUNC)dl->GetSymbol(wxT("GetPluginInterfaceVersion"), &success); if(success) { interface_version = pfnInterfaceVersion(); } else { CL_WARNING(wxT("Failed to find GetPluginInterfaceVersion() in dll: ") + fileName); if(!dl->GetError().IsEmpty()) { CL_WARNING(dl->GetError()); } } if(interface_version != PLUGIN_INTERFACE_VERSION) { CL_WARNING(wxString::Format(wxT("Version interface mismatch error for plugin '%s'. Plugin's interface " "version is '%d', CodeLite interface version is '%d'"), fileName.c_str(), interface_version, PLUGIN_INTERFACE_VERSION)); continue; } // Check if this dll can be loaded PluginInfo pluginInfo = pfnGetPluginInfo(); wxString pname = pluginInfo.GetName(); pname.MakeLower().Trim().Trim(false); // Check the policy if(pp == CodeLiteApp::PP_FromList && allowedPlugins.Index(pname) == wxNOT_FOUND) { // Policy is set to 'from list' and this plugin does not match any plugins from // the list, don't allow it to be loaded continue; } // Add the plugin information m_pluginsData.AddPlugin(pluginInfo); // Can we load it? if(!m_pluginsData.CanLoad(pluginInfo.GetName())) { CL_WARNING(wxT("Plugin ") + pluginInfo.GetName() + wxT(" is not enabled")); continue; } // try and load the plugin GET_PLUGIN_CREATE_FUNC pfn = (GET_PLUGIN_CREATE_FUNC)dl->GetSymbol(wxT("CreatePlugin"), &success); if(!success) { CL_WARNING(wxT("Failed to find CreatePlugin() in dll: ") + fileName); if(!dl->GetError().IsEmpty()) { CL_WARNING(dl->GetError()); } m_pluginsData.DisablePlugin(pluginInfo.GetName()); continue; } // Construct the plugin IPlugin* plugin = pfn((IManager*)this); CL_DEBUG(wxT("Loaded plugin: ") + plugin->GetLongName()); m_plugins[plugin->GetShortName()] = plugin; // Load the toolbar clToolBar* tb = plugin->CreateToolBar((wxWindow*)clMainFrame::Get()); if(tb) { #if USE_AUI_TOOLBAR // When using AUI toolbars, use our own custom art-provider tb->SetArtProvider(new CLMainAuiTBArt()); #endif clMainFrame::Get()->GetDockingManager().AddPane(tb, wxAuiPaneInfo() .Name(plugin->GetShortName()) .LeftDockable(true) .RightDockable(true) .Caption(plugin->GetShortName()) .ToolbarPane() .Top() .Row(0)); // Add menu entry at the 'View->Toolbars' menu for this toolbar wxMenuItem* item = clMainFrame::Get()->GetMenuBar()->FindItem(XRCID("toolbars_menu")); if(item) { wxMenu* submenu = NULL; submenu = item->GetSubMenu(); // add the new toolbar entry at the end of this menu int id = wxNewId(); wxString text(plugin->GetShortName()); text << _(" ToolBar"); wxMenuItem* newItem = new wxMenuItem(submenu, id, text, wxEmptyString, wxITEM_CHECK); submenu->Append(newItem); clMainFrame::Get()->RegisterToolbar(id, plugin->GetShortName()); } } // Keep the dynamic load library m_dl.push_back(dl); } clMainFrame::Get()->GetDockingManager().Update(); // Let the plugins plug their menu in the 'Plugins' menu at the menu bar // the create menu will be placed as a sub menu of the 'Plugin' menu wxMenu* pluginsMenu = NULL; wxMenuItem* menuitem = clMainFrame::Get()->GetMenuBar()->FindItem(XRCID("manage_plugins"), &pluginsMenu); if(pluginsMenu && menuitem) { std::map<wxString, IPlugin*>::iterator iter = m_plugins.begin(); for(; iter != m_plugins.end(); ++iter) { IPlugin* plugin = iter->second; plugin->CreatePluginMenu(pluginsMenu); } } // save the plugins data conf.WriteItem(&m_pluginsData); } // Now that all the plugins are loaded, load from the configuration file // list of visible tabs static wxArrayString DefaultArray; if(DefaultArray.IsEmpty()) { DefaultArray.Add("NOT-FOUND"); } { const wxArrayString& tabs = GetWorkspaceTabs(); wxArrayString visibleTabs = clConfig::Get().Read("VisibleWorkspaceTabs", DefaultArray); if(!((visibleTabs.size() == 1) && (visibleTabs.Item(0) == "NOT-FOUND"))) { for(size_t i = 0; i < tabs.size(); ++i) { if(visibleTabs.Index(tabs.Item(i)) == wxNOT_FOUND) { // hidden tab - post an event clCommandEvent eventHide(wxEVT_SHOW_WORKSPACE_TAB); eventHide.SetSelected(false).SetString(tabs.Item(i)); EventNotifier::Get()->AddPendingEvent(eventHide); } } } } { const wxArrayString& tabs = GetOutputTabs(); wxArrayString visibleTabs = clConfig::Get().Read("VisibleOutputTabs", DefaultArray); if(!((visibleTabs.size() == 1) && (visibleTabs.Item(0) == "NOT-FOUND"))) { for(size_t i = 0; i < tabs.size(); ++i) { if(visibleTabs.Index(tabs.Item(i)) == wxNOT_FOUND) { // hidden tab - post an event clCommandEvent eventHide(wxEVT_SHOW_OUTPUT_TAB); eventHide.SetSelected(false).SetString(tabs.Item(i)); EventNotifier::Get()->AddPendingEvent(eventHide); } } } } }
bool DebuggerMgr::LoadDebuggers(const wxString& strDebuggersDir) { wxString ext; #if defined (__WXMSW__) ext = wxT("dll"); #else ext = wxT("so"); #endif wxString fileSpec(wxT("*.")+ext); //get list of dlls wxArrayString files; wxString debuggersPath(strDebuggersDir, wxConvUTF8); debuggersPath += wxT("/debuggers"); wxDir::GetAllFiles(debuggersPath, &files, fileSpec, wxDIR_FILES); for(size_t i=0; i<files.GetCount(); i++){ clDynamicLibrary *dl = new clDynamicLibrary(); wxString fileName(files.Item(i)); if(!dl->Load(fileName)){ wxLogMessage(wxT("Failed to load debugger's dll: ") + fileName); if (!dl->GetError().IsEmpty()) wxLogMessage(dl->GetError()); delete dl; continue; } bool success(false); GET_DBG_INFO_FUNC pfn = (GET_DBG_INFO_FUNC)dl->GetSymbol(wxT("GetDebuggerInfo"), &success); if(!success){ wxLogMessage(wxT("Failed to find GetDebuggerInfo() in dll: ") + fileName); if (!dl->GetError().IsEmpty()) wxLogMessage(dl->GetError()); //dl->Unload(); delete dl; continue; } DebuggerInfo info = pfn(); //Call the init method to create an instance of the debugger success = false; GET_DBG_CREATE_FUNC pfnInitDbg = (GET_DBG_CREATE_FUNC)dl->GetSymbol(info.initFuncName, &success); if(!success){ wxLogMessage(wxT("Failed to find init function in dll: ") + fileName); if (!dl->GetError().IsEmpty()) wxLogMessage(dl->GetError()); dl->Detach(); delete dl; continue; } wxLogMessage(wxT("Loaded debugger: ") + info.name + wxT(", Version: ") + info.version); IDebugger *dbg = pfnInitDbg(); //set the environment dbg->SetEnvironment(m_env); m_debuggers[info.name] = dbg; //keep the dynamic load library m_dl.push_back(dl); } return true; }
bool DebuggerMgr::LoadDebuggers() { wxString ext; #if defined(__WXMSW__) ext = wxT("dll"); #elif defined(__WXMAC__) ext = wxT("dylib"); #else ext = wxT("so"); #endif wxString fileSpec(wxT("*.") + ext); // get list of dlls wxArrayString files; #ifdef __WXGTK__ wxString debuggersPath(PLUGINS_DIR, wxConvUTF8); debuggersPath += wxT("/debuggers"); #elif defined(__WXMSW__) #ifdef USE_POSIX_LAYOUT wxString debuggersPath(clStandardPaths::Get().GetPluginsDirectory() + wxT("/debuggers")); #else wxString debuggersPath(m_baseDir + wxT("/debuggers")); #endif #else // OSX wxFileName debuggersFolder(clStandardPaths::Get().GetDataDir(), ""); debuggersFolder.AppendDir("debuggers"); wxString debuggersPath(debuggersFolder.GetPath()); #endif CL_DEBUG("Loading debuggers from: %s", debuggersPath); wxDir::GetAllFiles(debuggersPath, &files, fileSpec, wxDIR_FILES); for(size_t i = 0; i < files.GetCount(); i++) { clDynamicLibrary* dl = new clDynamicLibrary(); wxString fileName(files.Item(i)); CL_DEBUG("Attempting to load debugger: %s", fileName); #if defined(__WXMSW__) && !defined(NDEBUG) // Under MSW loading a release plugin while in debug mode will cause a crash if(!fileName.EndsWith("-dbg.dll")) { continue; } #elif defined(__WXMSW__) // filter debug plugins if(fileName.EndsWith("-dbg.dll")) { continue; } #endif if(!dl->Load(fileName)) { CL_WARNING("Failed to load debugger: %s", fileName); if(!dl->GetError().IsEmpty()) { CL_WARNING("%s", dl->GetError()); } delete dl; continue; } bool success(false); GET_DBG_INFO_FUNC pfn = (GET_DBG_INFO_FUNC)dl->GetSymbol(wxT("GetDebuggerInfo"), &success); if(!success) { wxLogMessage(wxT("Failed to find GetDebuggerInfo() in dll: ") + fileName); if(!dl->GetError().IsEmpty()) { wxLogMessage(dl->GetError()); } // dl->Unload(); delete dl; continue; } DebuggerInfo info = pfn(); // Call the init method to create an instance of the debugger success = false; GET_DBG_CREATE_FUNC pfnInitDbg = (GET_DBG_CREATE_FUNC)dl->GetSymbol(info.initFuncName, &success); if(!success) { wxLogMessage(wxT("Failed to find init function in dll: ") + fileName); if(!dl->GetError().IsEmpty()) { wxLogMessage(dl->GetError()); } dl->Detach(); delete dl; continue; } wxLogMessage(wxT("Loaded debugger: ") + info.name + wxT(", Version: ") + info.version); IDebugger* dbg = pfnInitDbg(); // set the environment dbg->SetEnvironment(m_env); m_debuggers[info.name] = dbg; // keep the dynamic load library m_dl.push_back(dl); } // Load all debuggers in the form of plugin (i.e. they dont implement the IDebugger interface) // and append them to a special list clDebugEvent queryPlugins(wxEVT_DBG_IS_PLUGIN_DEBUGGER); EventNotifier::Get()->ProcessEvent(queryPlugins); m_pluginsDebuggers.swap(queryPlugins.GetStrings()); return true; }