mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-06 20:12:29 +00:00
TemplateRegistry: make the user-templates.toml generation more robust
This commit is contained in:
@@ -206,12 +206,16 @@ Singleton {
|
|||||||
function doWriteUserTemplatesToml() {
|
function doWriteUserTemplatesToml() {
|
||||||
var userConfigPath = Settings.configDir + "user-templates.toml"
|
var userConfigPath = Settings.configDir + "user-templates.toml"
|
||||||
var configContent = buildUserTemplatesToml()
|
var configContent = buildUserTemplatesToml()
|
||||||
|
var userConfigPathEsc = userConfigPath.replace(/'/g, "'\\''")
|
||||||
|
|
||||||
// Ensure directory exists (should already exist but just in case)
|
// Ensure directory exists (should already exist but just in case)
|
||||||
Quickshell.execDetached(["mkdir", "-p", Settings.configDir])
|
Quickshell.execDetached(["mkdir", "-p", Settings.configDir])
|
||||||
|
|
||||||
// Write the config file
|
// Write the config file using heredoc to avoid escaping issues
|
||||||
Quickshell.execDetached(["sh", "-c", `echo '${configContent.replace(/'/g, "'\\''")}' > '${userConfigPath}'`])
|
var script = `cat > '${userConfigPathEsc}' << 'EOF'\n`
|
||||||
|
script += configContent
|
||||||
|
script += "EOF\n"
|
||||||
|
Quickshell.execDetached(["sh", "-c", script])
|
||||||
|
|
||||||
Logger.d("TemplateRegistry", "User templates config written to:", userConfigPath)
|
Logger.d("TemplateRegistry", "User templates config written to:", userConfigPath)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user