ecode: detect file system changes in the project directory tree.

This commit is contained in:
Martín Lucas Golini
2021-01-24 01:06:45 -03:00
parent 239c5e00c6
commit 5b33d8ed5e
8 changed files with 236 additions and 12 deletions

View File

@@ -1126,6 +1126,9 @@ void App::closeEditors() {
tabWidget->removeTab( (UITab*)editor->getData() );
}
mCurrentProject = "";
mDirTree = nullptr;
if ( mFileSystemListener )
mFileSystemListener->setDirTree( mDirTree );
}
void App::closeFolder() {
@@ -1253,7 +1256,7 @@ void App::hideLocateBar() {
}
bool App::isDirTreeReady() const {
return mDirTreeReady;
return mDirTreeReady && mDirTree != nullptr;
}
NotificationCenter* App::getNotificationCenter() const {
@@ -1650,7 +1653,8 @@ void App::removeFolderWatches() {
void App::loadDirTree( const std::string& path ) {
Clock* clock = eeNew( Clock, () );
mDirTree = std::make_unique<ProjectDirectoryTree>( path, mThreadPool );
mDirTreeReady = false;
mDirTree = std::make_shared<ProjectDirectoryTree>( path, mThreadPool );
Log::info( "Loading DirTree: %s", path.c_str() );
mDirTree->scan(
[&, clock]( ProjectDirectoryTree& dirTree ) {
@@ -1664,6 +1668,7 @@ void App::loadDirTree( const std::string& path ) {
auto newDirs = dirTree.getDirectories();
for ( const auto& dir : newDirs )
mFolderWatches.insert( mFileWatcher->addWatch( dir, mFileSystemListener ) );
mFileSystemListener->setDirTree( mDirTree );
}
},
SyntaxDefinitionManager::instance()->getExtensionsPatternsSupported() );