fix: missing splitter for env

Using QStringList's `join` instead of QString's `append`
to package envrionments.
This commit is contained in:
Ye ShanShan 2024-04-07 11:40:18 +08:00 committed by Comix
parent f1031391ea
commit 4a4e8866bd

View File

@ -34,21 +34,19 @@
void ApplicationService::appendExtraEnvironments(QVariantMap &runtimeOptions) const noexcept void ApplicationService::appendExtraEnvironments(QVariantMap &runtimeOptions) const noexcept
{ {
QString oldEnv; QStringList envs;
if (auto it = runtimeOptions.find("env"); it != runtimeOptions.cend()) {
oldEnv = it->value<QString>();
}
const QString &env = environ(); const QString &env = environ();
if (!env.isEmpty()) { if (!env.isEmpty())
//NOTE: prepend this directly may lead some error envs.append(env);
oldEnv.prepend(env);
if (auto it = runtimeOptions.find("env"); it != runtimeOptions.cend()) {
envs.append(it->value<QString>());
} }
// NOTE: dde-dock need this environment variable for now, maybe we could remove it after we finish refactoring dde-shell. // NOTE: dde-dock need this environment variable for now, maybe we could remove it after we finish refactoring dde-shell.
oldEnv.append(QString{"GIO_LAUNCHED_DESKTOP_FILE=%1;"}.arg(m_desktopSource.sourcePath())); envs.append(QString{"GIO_LAUNCHED_DESKTOP_FILE=%1"}.arg(m_desktopSource.sourcePath()));
runtimeOptions.insert("env", oldEnv); runtimeOptions.insert("env", envs.join(';'));
} }
ApplicationService::ApplicationService(DesktopFile source, ApplicationService::ApplicationService(DesktopFile source,