MCPcopy Create free account
hub / github.com/SpartanJ/eepp / onLoadProject

Method onLoadProject

src/tools/ecode/plugins/debugger/debuggerplugin.cpp:237–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237void DebuggerPlugin::onLoadProject( const std::string& projectFolder,
238 const std::string& projectStatePath ) {
239 mProjectPath = projectFolder;
240
241 ScopedOp op( [this] { closeProject(); },
242 [this] {
243 auto sdc = getStatusDebuggerController();
244 if ( sdc && sdc->getUIBreakpoints() ) {
245 sdc->getUIBreakpoints()->runOnMainThread( [this, sdc] {
246 sdc->getUIBreakpoints()->setModel( mBreakpointsModel );
247 } );
248 }
249 } );
250
251 std::string debuggerStatePath( projectStatePath + "debugger.json" );
252 std::string data;
253 if ( !FileSystem::fileGet( debuggerStatePath, data ) )
254 return;
255
256 auto sdc = getStatusDebuggerController();
257
258 json j;
259 try {
260 j = json::parse( data, nullptr, true, true );
261 if ( j.contains( "config" ) && j["config"].is_object() ) {
262 auto& config = j["config"];
263 mCurDebugger = config.value( "debugger", "" );
264 mCurConfiguration = config.value( "configuration", "" );
265 mExpressions.clear();
266 if ( config.contains( "expressions" ) && config["expressions"].is_array() ) {
267 auto& exps = config["expressions"];
268 if ( mExpressionsHolder )
269 mExpressionsHolder->clear( true );
270 for ( const auto& expression : exps ) {
271 if ( expression.is_string() ) {
272 mExpressions.push_back( expression.get<std::string>() );
273 if ( mExpressionsHolder ) {
274 mExpressionsHolder->addChild(
275 std::make_shared<ModelVariableNode>( expression, 0 ) );
276 }
277 }
278 }
279
280 if ( sdc && sdc->getWidget() && sdc->getUIExpressions() )
281 sdc->getUIExpressions()->setModel( mExpressionsHolder->getModel() );
282 }
283
284 if ( config.contains( "breakpoints" ) && config["breakpoints"].is_object() ) {
285 BreakpointsHolder breakpoints;
286 for ( auto& [key, value] : config["breakpoints"].items() ) {
287 if ( value.is_array() ) {
288 BreakpointsSet set;
289 for ( auto& jbp : value ) {
290 SourceBreakpointStateful bp;
291 bp.line = jbp.value( "line", 1 );
292 bp.enabled = jbp.value( "enabled", true );
293 if ( bp.line > 0 )
294 set.insert( std::move( bp ) );

Callers

nothing calls this directly

Calls 14

errorFunction · 0.85
getUIBreakpointsMethod · 0.80
runOnMainThreadMethod · 0.80
push_backMethod · 0.80
getUIExpressionsMethod · 0.80
setModelMethod · 0.45
containsMethod · 0.45
valueMethod · 0.45
clearMethod · 0.45
addChildMethod · 0.45
getWidgetMethod · 0.45
getModelMethod · 0.45

Tested by

no test coverage detected