From 2127129227cf998f1f9f11b84a20ce6e541268f3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 14 Apr 2024 09:25:03 +0200 Subject: [PATCH] [users] Use API to get file-paths in target --- src/modules/users/ActiveDirectoryJob.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/modules/users/ActiveDirectoryJob.cpp b/src/modules/users/ActiveDirectoryJob.cpp index 7f24f5931..5db18d2e5 100644 --- a/src/modules/users/ActiveDirectoryJob.cpp +++ b/src/modules/users/ActiveDirectoryJob.cpp @@ -47,11 +47,8 @@ ActiveDirectoryJob::exec() QString domain = m_activeDirectoryInfo.value(2); QString ip = m_activeDirectoryInfo.value(3); - Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); - QString rootMountPoint = gs ? gs->value("rootMountPoint").toString() : QString(); - if (!ip.isEmpty()) { - QString hostsFilePath = !rootMountPoint.isEmpty() ? rootMountPoint + "/etc/hosts" : "/etc/hosts"; + const QString hostsFilePath = Calamares::System::instance()->targetPath(QStringLiteral("/etc/hosts"));; QFile hostsFile(hostsFilePath); if (hostsFile.open(QIODevice::Append | QIODevice::Text)) { QTextStream out(&hostsFile); @@ -62,7 +59,7 @@ ActiveDirectoryJob::exec() } } - QString installPath = !rootMountPoint.isEmpty() ? rootMountPoint : "/"; + const QString installPath = Calamares::System::instance()->targetPath(QStringLiteral("/")); QStringList args = {"join", domain, "-U", username, "--install=" + installPath, "--verbose"}; QProcess process;