From 3e2ce40b18af943f9ba370ed73565e9f487663ef Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sat, 18 Oct 2025 14:09:03 -0700 Subject: [PATCH] core: reference configs by absolute instead of canonical paths --- changelog/next.md | 11 +++++++++++ src/core/scan.cpp | 6 +++--- src/core/scan.hpp | 2 -- src/launch/command.cpp | 8 ++++---- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/changelog/next.md b/changelog/next.md index 53b50c8..93d1f2f 100644 --- a/changelog/next.md +++ b/changelog/next.md @@ -1,3 +1,14 @@ +## Breaking Changes + +### Config paths are no longer canonicalized + +This fixes nix configs changing shell-ids on rebuild as the shell id is now derived from +the symlink path. Configs with a symlink in their path will have a different shell id. + +Shell ids are used to derive the default config / state / cache folders, so those files +will need to be manually moved if using a config behind a symlinked path without an explicitly +set shell id. + ## New Features - Added support for creating wayland idle inhibitors. diff --git a/src/core/scan.cpp b/src/core/scan.cpp index 4306de7..45413fb 100644 --- a/src/core/scan.cpp +++ b/src/core/scan.cpp @@ -163,7 +163,7 @@ bool QmlScanner::scanQmlFile(const QString& path, bool& singleton, bool& interna qCDebug(logQmlScanner) << "Found imports" << imports; } - auto currentdir = QDir(QFileInfo(path).canonicalPath()); + auto currentdir = QDir(QFileInfo(path).absolutePath()); // the root can never be a singleton so it dosent matter if we skip it this->scanDir(currentdir.path()); @@ -179,9 +179,9 @@ bool QmlScanner::scanQmlFile(const QString& path, bool& singleton, bool& interna } auto pathInfo = QFileInfo(ipath); - auto cpath = pathInfo.canonicalFilePath(); + auto cpath = pathInfo.absoluteFilePath(); - if (cpath.isEmpty()) { + if (!pathInfo.exists()) { qCWarning(logQmlScanner) << "Ignoring unresolvable import" << ipath << "from" << path; continue; } diff --git a/src/core/scan.hpp b/src/core/scan.hpp index 1d3be85..9d88f07 100644 --- a/src/core/scan.hpp +++ b/src/core/scan.hpp @@ -16,9 +16,7 @@ public: QmlScanner() = default; QmlScanner(const QDir& rootPath): rootPath(rootPath) {} - // path must be canonical void scanDir(const QString& path); - void scanQmlRoot(const QString& path); QVector scannedDirs; diff --git a/src/launch/command.cpp b/src/launch/command.cpp index 18dcc43..81a9243 100644 --- a/src/launch/command.cpp +++ b/src/launch/command.cpp @@ -110,7 +110,7 @@ int locateConfigFile(CommandState& cmd, QString& path) { } if (split[0].trimmed() == *cmd.config.name) { - path = QDir(QFileInfo(file).canonicalPath()).filePath(split[1].trimmed()); + path = QDir(QFileInfo(file).absolutePath()).filePath(split[1].trimmed()); break; } } @@ -140,8 +140,7 @@ int locateConfigFile(CommandState& cmd, QString& path) { return -1; } - path = QFileInfo(path).canonicalFilePath(); - return 0; + goto rpath; } } @@ -154,7 +153,8 @@ int locateConfigFile(CommandState& cmd, QString& path) { return -1; } - path = QFileInfo(path).canonicalFilePath(); +rpath: + path = QFileInfo(path).absoluteFilePath(); return 0; }