mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(config): ensure trailing slash
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
@@ -7,9 +8,7 @@ QtObject {
|
||||
function migrate(adapter, logger, rawJson) {
|
||||
logger.i("Migration44", "Updating PAM pam/password.conf");
|
||||
|
||||
// Copying logic from Settings.qml to avoid dependency on it
|
||||
const shellName = "noctalia";
|
||||
const configDir = Quickshell.env("NOCTALIA_CONFIG_DIR") || (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/" + shellName + "/";
|
||||
const configDir = Settings.configDir;
|
||||
const pamConfigDir = configDir + "pam";
|
||||
const pamConfigFile = pamConfigDir + "/password.conf";
|
||||
const pamConfigDirEsc = pamConfigDir.replace(/'/g, "'\\''");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
@@ -7,8 +8,7 @@ QtObject {
|
||||
function migrate(adapter, logger, rawJson) {
|
||||
logger.i("Migration46", "Removing legacy PAM configuration file");
|
||||
|
||||
const shellName = "noctalia";
|
||||
const configDir = Quickshell.env("NOCTALIA_CONFIG_DIR") || (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/" + shellName + "/";
|
||||
const configDir = Settings.configDir;
|
||||
const pamConfigDir = configDir + "pam";
|
||||
// Remove the entire pam directory if it exists
|
||||
const script = `rm -rf '${pamConfigDir}'`;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
@@ -7,10 +8,7 @@ QtObject {
|
||||
function migrate(adapter, logger, rawJson) {
|
||||
logger.i("Migration47", "Removing network_stats.json cache");
|
||||
|
||||
// Remove the network_stats.json cache file (no longer used - autoscaling from history now)
|
||||
const shellName = "noctalia";
|
||||
const cacheDir = Quickshell.env("NOCTALIA_CACHE_DIR") || (Quickshell.env("XDG_CACHE_HOME") || Quickshell.env("HOME") + "/.cache") + "/" + shellName + "/";
|
||||
const networkStatsFile = cacheDir + "network_stats.json";
|
||||
const networkStatsFile = Settings.cacheDir + "network_stats.json";
|
||||
Quickshell.execDetached(["rm", "-f", networkStatsFile]);
|
||||
|
||||
logger.d("Migration47", "Removed network_stats.json");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
@@ -8,7 +9,7 @@ QtObject {
|
||||
logger.i("Settings", "Migrating settings to v56 (Color Scheme Migration)");
|
||||
|
||||
const scriptPath = Quickshell.shellDir + "/Scripts/python/src/theming/migrate-colorschemes.py";
|
||||
const configDir = Quickshell.env("NOCTALIA_CONFIG_DIR") || (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/noctalia";
|
||||
const configDir = Settings.configDir;
|
||||
|
||||
logger.i("Settings", `Running color scheme migration script: ${scriptPath} with configDir: ${configDir}`);
|
||||
|
||||
|
||||
+10
-3
@@ -28,8 +28,9 @@ Singleton {
|
||||
readonly property int settingsVersion: 59
|
||||
property bool isDebug: Quickshell.env("NOCTALIA_DEBUG") === "1"
|
||||
readonly property string shellName: "noctalia"
|
||||
readonly property string configDir: Quickshell.env("NOCTALIA_CONFIG_DIR") || (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/" + shellName + "/"
|
||||
readonly property string cacheDir: Quickshell.env("NOCTALIA_CACHE_DIR") || (Quickshell.env("XDG_CACHE_HOME") || Quickshell.env("HOME") + "/.cache") + "/" + shellName + "/"
|
||||
readonly property string configDir: ensureTrailingSlash(Quickshell.env("NOCTALIA_CONFIG_DIR") || (Quickshell.env("XDG_CONFIG_HOME") || Quickshell.env("HOME") + "/.config") + "/" + shellName + "/")
|
||||
readonly property string cacheDir: ensureTrailingSlash(Quickshell.env("NOCTALIA_CACHE_DIR") || (Quickshell.env("XDG_CACHE_HOME") || Quickshell.env("HOME") + "/.cache") + "/" + shellName + "/")
|
||||
|
||||
readonly property string settingsFile: Quickshell.env("NOCTALIA_SETTINGS_FILE") || (configDir + "settings.json")
|
||||
readonly property string defaultLocation: "Tokyo"
|
||||
readonly property string defaultAvatar: Quickshell.env("HOME") + "/.face"
|
||||
@@ -777,7 +778,13 @@ Singleton {
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Function to preprocess paths by expanding "~" to user's home directory
|
||||
// Preprocess paths by adding trailing "/"
|
||||
function ensureTrailingSlash(path) {
|
||||
return path.endsWith("/") ? path : path + "/";
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Preprocess paths by expanding "~" to user's home directory
|
||||
function preprocessPath(path) {
|
||||
if (typeof path !== "string" || path === "") {
|
||||
return path;
|
||||
|
||||
Reference in New Issue
Block a user