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

Method loadFolder

src/tools/ecode/ecode.cpp:4076–4186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4074}
4075
4076void App::loadFolder( std::string path, bool forceNewWindow ) {
4077 if ( !FileSystem::fileExists( path ) || !FileSystem::isDirectory( path ) ) {
4078 auto msgBox = UIMessageBox::New(
4079 UIMessageBox::OK, i18n( "directory_does_not_exist",
4080 "The directory does not exists and cannot be opened" ) );
4081 msgBox->setTitle( i18n( "invalid_directory", "Invalid Directory" ) );
4082 msgBox->center();
4083 msgBox->showWhenReady();
4084 updateRecentFolders();
4085 return;
4086 }
4087
4088 restoreMaximizedTabWidget();
4089
4090 Clock dirTreeClock;
4091
4092 if ( FileSystem::fileExtension( path ) == "lnk" ) {
4093 auto target = Sys::getShortcutTarget( path );
4094 if ( !target.empty() ) {
4095 if ( FileSystem::fileExists( target ) )
4096 path = target;
4097 else
4098 return;
4099 } else if ( !FileSystem::fileExists( path ) )
4100 return;
4101 }
4102
4103 if ( ( mConfig.ui.openProjectInNewWindow || forceNewWindow ) &&
4104 ( !mCurrentProject.empty() && mCurrentProject != getPlaygroundPath() ) ) {
4105 openInNewWindow( "\"" + path + "\"" );
4106 return;
4107 }
4108
4109 bool projectWasLoaded = !mCurrentProject.empty();
4110 if ( projectWasLoaded ) {
4111 saveSidePanelTabsOrder();
4112
4113 closeEditors();
4114 } else {
4115 mSplitter->removeTabWithOwnedWidgetId( "welcome_ecode" );
4116 mStatusBar->setVisible( mConfig.ui.showStatusBar );
4117 }
4118
4119 if ( !mProjectTreeView ) {
4120 showSidePanel( mConfig.ui.showSidePanel );
4121 showStatusBar( mConfig.ui.showStatusBar );
4122 initProjectTreeViewUI();
4123 }
4124
4125 mProjectViewEmptyCont->setVisible( path == getPlaygroundPath() );
4126 mProjectTreeView->setVisible( !mProjectViewEmptyCont->isVisible() );
4127
4128 std::string rpath( FileSystem::getRealPath( path ) );
4129 FileSystem::dirAddSlashAtEnd( rpath );
4130
4131 mCurrentProject = rpath;
4132 mCurrentProjectName = FileSystem::fileNameFromPath( mCurrentProject );
4133

Callers 1

createProjectTreeMenuMethod · 0.80

Calls 15

infoFunction · 0.85
centerMethod · 0.80
showWhenReadyMethod · 0.80
resetFileAssociationsMethod · 0.80
asMillisecondsMethod · 0.80
getElapsedTimeMethod · 0.80
setFileSystemModelMethod · 0.80
getCurWidgetMethod · 0.80
getCurEditorMethod · 0.80
setWorkspaceFolderMethod · 0.80

Tested by

no test coverage detected