| 3455 | } |
| 3456 | |
| 3457 | void App::loadDirTree( const std::string& path ) { |
| 3458 | Clock clock; |
| 3459 | mDirTreeReady = false; |
| 3460 | mDirTree = std::make_shared<ProjectDirectoryTree>( |
| 3461 | path, mThreadPool, mPluginManager.get(), |
| 3462 | [this]( auto path ) { loadFileFromPathOrFocus( path ); } ); |
| 3463 | Log::info( "Loading DirTree: %s", path ); |
| 3464 | std::vector<std::string> supportedExts( |
| 3465 | SyntaxDefinitionManager::instance()->getExtensionsPatternsSupported() ); |
| 3466 | auto imgExts( Image::getImageExtensionsSupported() ); |
| 3467 | supportedExts.reserve( supportedExts.size() + imgExts.size() ); |
| 3468 | for ( auto& ext : imgExts ) { |
| 3469 | ext.insert( 0, "%." ); |
| 3470 | ext += "$"; |
| 3471 | supportedExts.push_back( ext ); |
| 3472 | } |
| 3473 | mDirTree->scan( |
| 3474 | [this, clock]( ProjectDirectoryTree& dirTree ) { |
| 3475 | Log::info( "DirTree read in: %s. Found %ld files.", clock.getElapsedTime().toString(), |
| 3476 | dirTree.getFilesCount() ); |
| 3477 | mDirTreeReady = true; |
| 3478 | mUISceneNode->runOnMainThread( [this] { |
| 3479 | mUniversalLocator->updateFilesTable(); |
| 3480 | if ( mSplitter->curEditorExistsAndFocused() ) |
| 3481 | syncProjectTreeWithEditor( mSplitter->getCurEditor() ); |
| 3482 | } ); |
| 3483 | removeFolderWatches(); |
| 3484 | if ( mFileWatcher ) { |
| 3485 | { |
| 3486 | Lock l( mWatchesLock ); |
| 3487 | mFolderWatches.insert( { dirTree.getPath(), 0 } ); |
| 3488 | } |
| 3489 | mFolderWatches[dirTree.getPath()] = |
| 3490 | mFileWatcher->addWatch( dirTree.getPath(), mFileSystemListener, true ); |
| 3491 | } |
| 3492 | mFileSystemListener->setDirTree( mDirTree ); |
| 3493 | }, |
| 3494 | supportedExts ); |
| 3495 | } |
| 3496 | |
| 3497 | UIMessageBox* App::errorMsgBox( const String& msg ) { |
| 3498 | UIMessageBox* msgBox = UIMessageBox::New( UIMessageBox::OK, msg ); |
nothing calls this directly
no test coverage detected