Skip to content

Commit

Permalink
src:Fix working directory path check
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
  • Loading branch information
QQxiaoming committed Nov 8, 2023
1 parent 525c91a commit ecc56d2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2310,9 +2310,12 @@ QString MainWindow::startLocalShellSession(MainWidgetGroup *group, const QString
QString workDir = getDirAndcheckeSysName(newTitle);
if(!workDir.isEmpty()) {
sessionsWindow->setShortTitle(workDir);
QFileInfo fileInfo(workDir.replace("~",QDir::homePath()));
if(workDir.startsWith("~/")) {
workDir = workDir.replace(0,1,QDir::homePath());
}
QFileInfo fileInfo(workDir);
if(fileInfo.isDir()) {
sessionsWindow->setWorkingDirectory(workDir.replace("~",QDir::homePath()));
sessionsWindow->setWorkingDirectory(workDir);
}
} else {
sessionsWindow->setShortTitle(newTitle);
Expand Down Expand Up @@ -2435,9 +2438,12 @@ int MainWindow::cloneCurrentSession(MainWidgetGroup *group, QString name)
QString workDir = getDirAndcheckeSysName(newTitle);
if(!workDir.isEmpty()) {
sessionsWindowClone->setShortTitle(workDir);
QFileInfo fileInfo(workDir.replace("~",QDir::homePath()));
if(workDir.startsWith("~/")) {
workDir = workDir.replace(0,1,QDir::homePath());
}
QFileInfo fileInfo(workDir);
if(fileInfo.isDir()) {
sessionsWindowClone->setWorkingDirectory(workDir.replace("~",QDir::homePath()));
sessionsWindowClone->setWorkingDirectory(workDir);
}
} else {
sessionsWindowClone->setShortTitle(newTitle);
Expand Down

0 comments on commit ecc56d2

Please sign in to comment.