refactor: handle space in the user name

This commit is contained in:
zhom
2026-02-21 16:21:03 +04:00
parent c61b3d3188
commit 1afc2ca5ff
3 changed files with 41 additions and 6 deletions
+8 -2
View File
@@ -244,16 +244,22 @@ pub fn enable_autostart() -> io::Result<()> {
let desktop_path = autostart_dir.join("donut-daemon.desktop");
let escaped_daemon_path = daemon_path
.display()
.to_string()
.replace('\\', "\\\\")
.replace('"', "\\\"")
.replace('`', "\\`")
.replace('$', "\\$");
let desktop_content = format!(
r#"[Desktop Entry]
Type=Application
Name=Donut Browser Daemon
Exec={} run
Exec="{escaped_daemon_path}" run
Hidden=false
NoDisplay=true
X-GNOME-Autostart-enabled=true
"#,
daemon_path.display()
);
fs::write(&desktop_path, desktop_content)?;