controller lin: do autostart path creation nicer
This commit is contained in:
parent
aa9c5a17ff
commit
b977b22410
|
@ -40,13 +40,15 @@ namespace SparkleShare {
|
||||||
// start SparkleShare automatically at login
|
// start SparkleShare automatically at login
|
||||||
public override void EnableSystemAutostart ()
|
public override void EnableSystemAutostart ()
|
||||||
{
|
{
|
||||||
string autostart_path = SparkleHelpers.CombineMore (SparklePaths.HomePath, ".config", "autostart");
|
string autostart_path = Path.Combine (Environment.GetFolderPath (
|
||||||
string desktopfile_path = SparkleHelpers.CombineMore (autostart_path, "sparkleshare.desktop");
|
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 (!File.Exists (desktopfile_path)) {
|
||||||
if (!Directory.Exists (autostart_path))
|
|
||||||
Directory.CreateDirectory (autostart_path);
|
|
||||||
|
|
||||||
TextWriter writer = new StreamWriter (desktopfile_path);
|
TextWriter writer = new StreamWriter (desktopfile_path);
|
||||||
writer.WriteLine ("[Desktop Entry]\n" +
|
writer.WriteLine ("[Desktop Entry]\n" +
|
||||||
"Type=Application\n" +
|
"Type=Application\n" +
|
||||||
|
@ -62,7 +64,7 @@ namespace SparkleShare {
|
||||||
UnixFileInfo file_info = new UnixFileInfo (desktopfile_path);
|
UnixFileInfo file_info = new UnixFileInfo (desktopfile_path);
|
||||||
file_info.Create (FileAccessPermissions.UserReadWriteExecute);
|
file_info.Create (FileAccessPermissions.UserReadWriteExecute);
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Controller", "Created: " + desktopfile_path);
|
SparkleHelpers.DebugInfo ("Controller", "Enabled autostart on login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue