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) {
|
||||
|
||||
string SparklePath = SparklePaths.SparklePath;
|
||||
|
||||
Process Process = new Process();
|
||||
Process.EnableRaisingEvents = false;
|
||||
Process.StartInfo.RedirectStandardOutput = true;
|
||||
Process.StartInfo.UseShellExecute = false;
|
||||
|
||||
string SparklePath = SparklePaths.SparklePath;
|
||||
|
||||
// Create 'SparkleShare' folder in the user's home folder
|
||||
// if it's not there already
|
||||
if (!Directory.Exists (SparklePath)) {
|
||||
|
@ -54,19 +54,19 @@ namespace SparkleShare {
|
|||
"folder-sparkleshare.png";
|
||||
Process.Start();
|
||||
|
||||
// Linux/GNOME specific: add the SparkleShare
|
||||
// folder to the bookmarks
|
||||
string BookmarksFileName =
|
||||
Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks");
|
||||
if (File.Exists (BookmarksFileName)) {
|
||||
TextWriter TextWriter = File.AppendText (BookmarksFileName);
|
||||
TextWriter.WriteLine ("file://" + SparklePath + " SparkleShare");
|
||||
TextWriter.Close();
|
||||
// Add the SparkleShare folder to the bookmarks
|
||||
if (SparklePlatform.Name.Equals ("GNOME")) {
|
||||
string BookmarksFileName =
|
||||
Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks");
|
||||
if (File.Exists (BookmarksFileName)) {
|
||||
TextWriter TextWriter = File.AppendText (BookmarksFileName);
|
||||
TextWriter.WriteLine ("file://" + SparklePath + " SparkleShare");
|
||||
TextWriter.Close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Get all the repos in ~/SparkleShare
|
||||
string [] Repos = Directory.GetDirectories (SparklePath);
|
||||
Repositories = new SparkleRepo [Repos.Length];
|
||||
|
|
Loading…
Reference in a new issue