Skip to content

Commit

Permalink
Automatically use the default configuration if the Profile does not e…
Browse files Browse the repository at this point in the history
…xist on Windows

Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
  • Loading branch information
QQxiaoming committed Aug 26, 2024
1 parent 2d359b6 commit 4fe7c8a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## [[Unrelease](https://github.com/QQxiaoming/quardCRT)]

en-US:

- Automatically use the default configuration if the Profile does not exist on Windows

zh-CN:

- Windows下Profile如果不存在则自动使用默认配置

## [[V0.5.0](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.5.0)] - 2024-08-26

en-US:
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## [[Unrelease](https://github.com/QQxiaoming/quardCRT)]

- Automatically use the default configuration if the Profile does not exist on Windows

## [[V0.5.0](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.5.0)] - 2024-08-26

- Add Python scripting engine for scripting feature [#31](https://github.com/QQxiaoming/quardCRT/pull/31)
Expand Down
11 changes: 11 additions & 0 deletions src/globaloptions/globaloptionswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,17 @@ bool GlobalOptionsWindow::getEnableCtrlC(void)
#if defined(Q_OS_WIN)
QString GlobalOptionsWindow::getPowerShellProfile(void)
{
GlobalSetting settings;
QString profile = settings.value("Global/Options/PowerShellProfile", QApplication::applicationDirPath() + "/Profile.ps1").toString();
if (!profile.isEmpty()) {
QFileInfo profileInfo(profile);
if(!profileInfo.exists() || !profileInfo.isFile()) {
globalOptionsAdvancedWidget->ui->lineEditPowerShellProfile->setText(QApplication::applicationDirPath() + "/Profile.ps1");
}
} else {
globalOptionsAdvancedWidget->ui->lineEditPowerShellProfile->setText(QApplication::applicationDirPath() + "/Profile.ps1");
}
settings.setValue("Global/Options/PowerShellProfile", globalOptionsAdvancedWidget->ui->lineEditPowerShellProfile->text());
return globalOptionsAdvancedWidget->ui->lineEditPowerShellProfile->text();
}
#endif
Expand Down

0 comments on commit 4fe7c8a

Please sign in to comment.