Fixes not reloading loaded document from an file system modified event after the first reload (SpartanJ/ecode#196).

Improved project search UI.
This commit is contained in:
Martín Lucas Golini
2024-03-14 22:57:44 -03:00
parent b3d0eea6fc
commit ff29ed3c71
11 changed files with 168 additions and 79 deletions

View File

@@ -733,7 +733,8 @@ App::~App() {
delete mFileWatcher;
mFileWatcher = nullptr;
}
mDirTree->resetPluginManager();
if ( mDirTree )
mDirTree->resetPluginManager();
mPluginManager.reset();
eeSAFE_DELETE( mSplitter );
@@ -1948,10 +1949,13 @@ void App::onRealDocumentLoaded( UICodeEditor* editor, const std::string& path )
}
TextDocument& doc = editor->getDocument();
std::string filePath =
doc.hasFilepath() ? doc.getFilePath()
: ( !doc.getLoadingFilePath().empty() ? doc.getLoadingFilePath() : "" );
if ( mFileWatcher && doc.hasFilepath() &&
( !mDirTree || !mDirTree->isDirInTree( doc.getFileInfo().getFilepath() ) ) ) {
std::string dir( FileSystem::fileRemoveFileName( doc.getFileInfo().getFilepath() ) );
if ( mFileWatcher && !filePath.empty() &&
( !mDirTree || !mDirTree->isDirInTree( filePath ) ) ) {
std::string dir( FileSystem::fileRemoveFileName( filePath ) );
mThreadPool->run( [this, dir] {
if ( mFileWatcher && !dirInFolderWatches( dir ) ) {
auto watchId = mFileWatcher->addWatch( dir, mFileSystemListener );