ecode: Start the terminal in the current working directory (the current project folder or the current file folder if no project is open).

This commit is contained in:
Martín Lucas Golini
2022-12-06 01:30:21 -03:00
parent 2f977e3b93
commit 1a1e7f5b62
7 changed files with 34 additions and 16 deletions

View File

@@ -1163,6 +1163,18 @@ String App::i18n( const std::string& key, const String& def ) {
return mUISceneNode->getTranslatorStringFromKey( key, def );
}
std::string App::getCurrentWorkingDir() const {
if ( !mCurrentProject.empty() )
return mCurrentProject;
if ( mSplitter && mSplitter->curEditorExists() && mSplitter->getCurEditor()->hasDocument() &&
mSplitter->getCurEditor()->getDocument().hasFilepath() ) {
return mSplitter->getCurEditor()->getDocument().getFileInfo().getDirectoryPath();
}
return "";
}
UIMenu* App::createEditMenu() {
UIPopUpMenu* menu = UIPopUpMenu::New();
menu->add( i18n( "undo", "Undo" ), findIcon( "undo" ), getKeybind( "undo" ) )->setId( "undo" );