From cdc70131919bcc3177deb4fd725cf133d77700be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Sun, 9 Jun 2024 14:37:37 -0300 Subject: [PATCH] Fixes in ecode saveProject. --- src/tools/ecode/appconfig.cpp | 9 +++++++-- src/tools/ecode/ecode.cpp | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tools/ecode/appconfig.cpp b/src/tools/ecode/appconfig.cpp index 4b96830b0..12ac88f20 100644 --- a/src/tools/ecode/appconfig.cpp +++ b/src/tools/ecode/appconfig.cpp @@ -368,10 +368,15 @@ json saveNode( Node* node ) { continue; if ( ownedWidget->isType( UI_TYPE_CODEEDITOR ) ) { UICodeEditor* editor = ownedWidget->asType(); - if ( !editor->getDocument().getFilePath().empty() ) { + if ( !editor->getDocument().isLoading() && editor->getDocument().isEmpty() ) + continue; + if ( !editor->getDocument().getFilePath().empty() || + !editor->getDocument().getLoadingFilePath().empty() ) { json f; f["type"] = "editor"; - f["path"] = editor->getDocument().getFilePath(); + f["path"] = editor->getDocument().isLoading() + ? editor->getDocument().getLoadingFilePath() + : editor->getDocument().getFilePath(); f["selection"] = editor->getDocument().getSelections().toString(); files.emplace_back( f ); } diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index b812fec88..82b107a86 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -2195,10 +2195,11 @@ bool App::isUnlockedCommand( const std::string& command ) { } void App::saveProject() { - if ( !mCurrentProject.empty() ) + if ( !mCurrentProject.empty() ) { mConfig.saveProject( mCurrentProject, mSplitter, mConfigPath, mProjectDocConfig, mProjectBuildManager ? mProjectBuildManager->getConfig() : ProjectBuildConfiguration() ); + } } void App::closeEditors() {