From b977b22410fd23f3b8a4c1e19b390205cfc3f67e Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sun, 5 Jun 2011 16:38:32 +0100 Subject: [PATCH] controller lin: do autostart path creation nicer --- SparkleShare/SparkleLinController.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/SparkleShare/SparkleLinController.cs b/SparkleShare/SparkleLinController.cs index 5da08dac..63824e30 100644 --- a/SparkleShare/SparkleLinController.cs +++ b/SparkleShare/SparkleLinController.cs @@ -40,13 +40,15 @@ namespace SparkleShare { // start SparkleShare automatically at login public override void EnableSystemAutostart () { - string autostart_path = SparkleHelpers.CombineMore (SparklePaths.HomePath, ".config", "autostart"); - string desktopfile_path = SparkleHelpers.CombineMore (autostart_path, "sparkleshare.desktop"); + string autostart_path = Path.Combine (Environment.GetFolderPath ( + Environment.SpecialFolder.ApplicationData, "autostart"); + + string desktopfile_path = Path.Combine (autostart_path, "sparkleshare.desktop"); + + if (!Directory.Exists (autostart_path)) + Directory.CreateDirectory (autostart_path); if (!File.Exists (desktopfile_path)) { - if (!Directory.Exists (autostart_path)) - Directory.CreateDirectory (autostart_path); - TextWriter writer = new StreamWriter (desktopfile_path); writer.WriteLine ("[Desktop Entry]\n" + "Type=Application\n" + @@ -62,7 +64,7 @@ namespace SparkleShare { UnixFileInfo file_info = new UnixFileInfo (desktopfile_path); file_info.Create (FileAccessPermissions.UserReadWriteExecute); - SparkleHelpers.DebugInfo ("Controller", "Created: " + desktopfile_path); + SparkleHelpers.DebugInfo ("Controller", "Enabled autostart on login"); } }