Skip to content

Commit

Permalink
Portal: Make autostart directory if not exists (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryonakano authored Jan 2, 2025
1 parent e6b5ecc commit 8fb7922
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Background/Portal.vala
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,22 @@ public class Background.Portal : Object {
_app_id = string.joinv ("-", commandline).replace ("--", "-").replace ("--", "-");
}

var file = File.new_build_filename (Environment.get_user_config_dir (), "autostart", _app_id + ".desktop");
var autostart_dir = File.new_build_filename (Environment.get_user_config_dir (), "autostart");
var file = autostart_dir.get_child (_app_id + ".desktop");
if (!enable) {
try { yield file.delete_async (); } catch {}
return false;
}

if (!autostart_dir.query_exists ()) {
try {
yield autostart_dir.make_directory_async ();
} catch (Error e) {
warning ("Failed to make autostart directory: %s", e.message);
throw new DBusError.FAILED (e.message);
}
}

var key_file = new KeyFile ();

if (file.query_exists ()) {
Expand Down

0 comments on commit 8fb7922

Please sign in to comment.