diff --git a/src/tools/ecode/appconfig.cpp b/src/tools/ecode/appconfig.cpp index d5da0d807..58bff8c05 100644 --- a/src/tools/ecode/appconfig.cpp +++ b/src/tools/ecode/appconfig.cpp @@ -533,7 +533,7 @@ void AppConfig::loadDocuments( UICodeEditorSplitter* editorSplitter, json j, std::string path( file["path"] ); if ( !FileSystem::fileExists( path ) ) { editorLoadedCounter( app ); - return; + continue; } TextRanges selection( TextRanges::fromString( file["selection"] ) ); UITab* tab = nullptr; diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 7a2bd3498..476e9c50a 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -522,6 +522,7 @@ bool App::loadConfig( const LogLevel& logLevel, const Sizeu& displaySize, bool s mLanguagesPath = mConfigPath + "languages"; mThemesPath = mConfigPath + "themes"; mScriptsPath = mConfigPath + "scripts"; + mPlaygroundPath = mConfigPath + "playground"; mColorSchemesPath = mConfigPath + "editor" + FileSystem::getOSSlash() + "colorschemes" + FileSystem::getOSSlash(); mTerminalManager = std::make_unique( this ); @@ -546,6 +547,10 @@ bool App::loadConfig( const LogLevel& logLevel, const Sizeu& displaySize, bool s FileSystem::makeDir( mScriptsPath ); FileSystem::dirAddSlashAtEnd( mScriptsPath ); + if ( !FileSystem::fileExists( mPlaygroundPath ) ) + FileSystem::makeDir( mPlaygroundPath ); + FileSystem::dirAddSlashAtEnd( mPlaygroundPath ); + mLogsPath = mConfigPath + "ecode.log"; #ifndef EE_DEBUG @@ -702,6 +707,10 @@ void App::onFileDropped( String file ) { codeEditor = d.second; tab = d.first; } + } else { + auto d = mSplitter->createEditorInNewTab(); + codeEditor = d.second; + tab = d.first; } loadFileFromPath( file, false, codeEditor, @@ -3228,6 +3237,9 @@ void App::initProjectTreeView( std::string path, bool openClean ) { } else if ( mConfig.workspace.restoreLastSession && !mRecentFolders.empty() && !openClean ) { loadFolder( mRecentFolders[0] ); } else { + if ( mConfig.workspace.autoSave && !openClean ) + loadFolder( getPlaygroundPath() ); + updateOpenRecentFolderBtn(); if ( getConfig().ui.welcomeScreen ) { @@ -3340,7 +3352,8 @@ void App::loadFolder( const std::string& path ) { mStatusBar->setVisible( mConfig.ui.showStatusBar ); } - mProjectViewEmptyCont->setVisible( false ); + mProjectViewEmptyCont->setVisible( path == getPlaygroundPath() ); + mProjectTreeView->setVisible( !mProjectViewEmptyCont->isVisible() ); std::string rpath( FileSystem::getRealPath( path ) ); FileSystem::dirAddSlashAtEnd( rpath ); @@ -3375,9 +3388,11 @@ void App::loadFolder( const std::string& path ) { if ( mFileSystemListener ) mFileSystemListener->setFileSystemModel( mFileSystemModel ); - insertRecentFolder( rpath ); - cleanUpRecentFolders(); - updateRecentFolders(); + if ( rpath != getPlaygroundPath() ) { + insertRecentFolder( rpath ); + cleanUpRecentFolders(); + updateRecentFolders(); + } mSettings->updateProjectSettingsMenu(); if ( mSplitter->getCurWidget() ) diff --git a/src/tools/ecode/ecode.hpp b/src/tools/ecode/ecode.hpp index 19816de76..5a37b925a 100644 --- a/src/tools/ecode/ecode.hpp +++ b/src/tools/ecode/ecode.hpp @@ -463,6 +463,8 @@ class App : public UICodeEditorSplitter::Client { const std::string getScriptsPath() const { return mScriptsPath; } + const std::string& getPlaygroundPath() const { return mPlaygroundPath; } + bool isAnyStatusBarSectionVisible() const; void createDocDirtyAlert( UICodeEditor* editor, bool showEnableAutoReload = true ); @@ -504,6 +506,7 @@ class App : public UICodeEditorSplitter::Client { std::string mLogsPath; std::string mi18nPath; std::string mScriptsPath; + std::string mPlaygroundPath; Float mDisplayDPI{ 96 }; std::shared_ptr mThreadPool; std::shared_ptr mDirTree;