[users] Use API to get file-paths in target

This commit is contained in:
Adriaan de Groot 2024-04-14 09:25:03 +02:00
parent d0420ea3ee
commit 2127129227

View File

@ -47,11 +47,8 @@ ActiveDirectoryJob::exec()
QString domain = m_activeDirectoryInfo.value(2); QString domain = m_activeDirectoryInfo.value(2);
QString ip = m_activeDirectoryInfo.value(3); QString ip = m_activeDirectoryInfo.value(3);
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
QString rootMountPoint = gs ? gs->value("rootMountPoint").toString() : QString();
if (!ip.isEmpty()) { 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); QFile hostsFile(hostsFilePath);
if (hostsFile.open(QIODevice::Append | QIODevice::Text)) { if (hostsFile.open(QIODevice::Append | QIODevice::Text)) {
QTextStream out(&hostsFile); 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"}; QStringList args = {"join", domain, "-U", username, "--install=" + installPath, "--verbose"};
QProcess process; QProcess process;