feat: add app extra/unset env config

to fix #8667 you can
- subpath:"/FoxitReader" appExtraEnvironments : "QT_QPA_PLATFORM=xcb"
- subpath:"/FoxitReader" appEnvironmentsBlacklist : "QT_QPA_PLATFORM"

```
dde-dconfig set -a org.deepin.dde.application-manager -r org.deepin.dde.application-manager -k appExtraEnvironments -s "/FoxitReader" -v "[\"QT_QPA_PLATFORM=xcb\"]"
dde-dconfig set -a org.deepin.dde.application-manager -r org.deepin.dde.application-manager -k appEnvironmentsBlacklist -s "/FoxitReader" -v "[\"QT_QPA_PLATFORM\"]"
```

Issue: https://github.com/linuxdeepin/developer-center/issues/8667
This commit is contained in:
ck
2024-05-22 11:32:11 +08:00
committed by mike
parent 006f80d681
commit 50a0ad53ec
10 changed files with 146 additions and 54 deletions

View File

@ -17,6 +17,8 @@ QStringList generateCommand(const QVariantMap &props) noexcept
options.emplace_back(std::make_unique<setUserLaunchOption>(value));
} else if (key == setEnvLaunchOption::key()) {
options.emplace_back(std::make_unique<setEnvLaunchOption>(value));
} else if (key == unsetEnvLaunchOption::key()) {
options.emplace_back(std::make_unique<unsetEnvLaunchOption>(value));
} else if (key == hookLaunchOption::key()) {
options.emplace_back(std::make_unique<hookLaunchOption>(value));
} else if (key == setWorkingPathLaunchOption::key()) {
@ -100,16 +102,6 @@ QStringList splitLaunchOption::generateCommandLine() const noexcept
return QStringList{m_val.toString()};
}
QStringList setEnvLaunchOption::generateCommandLine() const noexcept
{
auto str = m_val.toString();
if (str.isEmpty()) {
return {};
}
return QStringList{QString{"--Environment=%1"}.arg(str)};
}
QStringList setWorkingPathLaunchOption::generateCommandLine() const noexcept
{
auto str = m_val.toString();
@ -120,13 +112,18 @@ QStringList setWorkingPathLaunchOption::generateCommandLine() const noexcept
return QStringList{QString{"--WorkingDirectory=%1"}.arg(str)};
}
QStringList builtInSearchExecOption::generateCommandLine() const noexcept
QStringList StringListLaunchOption::generateCommandLine() const noexcept
{
auto list = m_val.toStringList();
if (list.isEmpty()) {
return {};
}
auto content = list.join(';');
return QStringList{QString{"--ExecSearchPath=%1"}.arg(content)};
QStringList ret;
const QString ok = optionKey();
for (const auto &ov : list) {
ret << QString{"%1=%2"}.arg(ok).arg(ov);
}
return ret;
}