add sparkleplatform class to check for the user's platform
This commit is contained in:
parent
8d634783b7
commit
58daa95368
|
@ -0,0 +1,28 @@
|
||||||
|
// SparkleShare, an instant update workflow to Git.
|
||||||
|
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace SparkleShare {
|
||||||
|
|
||||||
|
public static class SparklePlatform {
|
||||||
|
|
||||||
|
// Detect OSX, Windows, GNOME or KDE here
|
||||||
|
public static string Name = "GNOME";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,13 +31,13 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleUI (bool HideUI) {
|
public SparkleUI (bool HideUI) {
|
||||||
|
|
||||||
string SparklePath = SparklePaths.SparklePath;
|
|
||||||
|
|
||||||
Process Process = new Process();
|
Process Process = new Process();
|
||||||
Process.EnableRaisingEvents = false;
|
Process.EnableRaisingEvents = false;
|
||||||
Process.StartInfo.RedirectStandardOutput = true;
|
Process.StartInfo.RedirectStandardOutput = true;
|
||||||
Process.StartInfo.UseShellExecute = false;
|
Process.StartInfo.UseShellExecute = false;
|
||||||
|
|
||||||
|
string SparklePath = SparklePaths.SparklePath;
|
||||||
|
|
||||||
// Create 'SparkleShare' folder in the user's home folder
|
// Create 'SparkleShare' folder in the user's home folder
|
||||||
// if it's not there already
|
// if it's not there already
|
||||||
if (!Directory.Exists (SparklePath)) {
|
if (!Directory.Exists (SparklePath)) {
|
||||||
|
@ -54,8 +54,8 @@ namespace SparkleShare {
|
||||||
"folder-sparkleshare.png";
|
"folder-sparkleshare.png";
|
||||||
Process.Start();
|
Process.Start();
|
||||||
|
|
||||||
// Linux/GNOME specific: add the SparkleShare
|
// Add the SparkleShare folder to the bookmarks
|
||||||
// folder to the bookmarks
|
if (SparklePlatform.Name.Equals ("GNOME")) {
|
||||||
string BookmarksFileName =
|
string BookmarksFileName =
|
||||||
Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks");
|
Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks");
|
||||||
if (File.Exists (BookmarksFileName)) {
|
if (File.Exists (BookmarksFileName)) {
|
||||||
|
@ -63,9 +63,9 @@ namespace SparkleShare {
|
||||||
TextWriter.WriteLine ("file://" + SparklePath + " SparkleShare");
|
TextWriter.WriteLine ("file://" + SparklePath + " SparkleShare");
|
||||||
TextWriter.Close();
|
TextWriter.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Get all the repos in ~/SparkleShare
|
// Get all the repos in ~/SparkleShare
|
||||||
string [] Repos = Directory.GetDirectories (SparklePath);
|
string [] Repos = Directory.GetDirectories (SparklePath);
|
||||||
|
|
Loading…
Reference in a new issue