2010-05-06 00:17:00 +00:00
|
|
|
// 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
|
2010-11-21 12:33:24 +00:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-05-06 00:17:00 +00:00
|
|
|
// 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;
|
2010-11-27 21:23:44 +00:00
|
|
|
using System.Diagnostics;
|
2010-05-08 14:31:44 +00:00
|
|
|
using System.IO;
|
2010-08-02 15:42:42 +00:00
|
|
|
using Mono.Unix;
|
2010-05-06 00:17:00 +00:00
|
|
|
|
2010-08-02 15:42:42 +00:00
|
|
|
namespace SparkleLib {
|
2010-05-06 00:17:00 +00:00
|
|
|
|
2010-06-15 23:24:48 +00:00
|
|
|
public static class SparklePaths
|
|
|
|
{
|
2010-11-27 21:23:44 +00:00
|
|
|
|
|
|
|
public static string GitPath = GetGitPath ();
|
2010-06-12 14:37:03 +00:00
|
|
|
|
2010-11-27 21:23:44 +00:00
|
|
|
public static string HomePath = new UnixUserInfo (UnixEnvironment.UserName).HomeDirectory;
|
2010-07-13 18:23:59 +00:00
|
|
|
|
2010-05-08 14:31:44 +00:00
|
|
|
public static string SparklePath = Path.Combine (HomePath ,"SparkleShare");
|
2010-05-06 00:17:00 +00:00
|
|
|
|
2010-06-11 17:58:40 +00:00
|
|
|
public static string SparkleTmpPath = Path.Combine (SparklePath, ".tmp");
|
|
|
|
|
2010-06-15 23:24:48 +00:00
|
|
|
public static string SparkleConfigPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
|
2010-08-26 08:52:49 +00:00
|
|
|
|
|
|
|
public static string SparkleKeysPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
|
2010-06-12 16:30:31 +00:00
|
|
|
|
2010-07-13 18:23:59 +00:00
|
|
|
public static string SparkleInstallPath = SparkleHelpers.CombineMore (Defines.PREFIX, "sparkleshare");
|
2010-06-12 16:29:32 +00:00
|
|
|
|
2010-11-07 22:53:12 +00:00
|
|
|
public static string SparkleLocalIconPath = SparkleHelpers.CombineMore (SparkleConfigPath, "icons", "hicolor");
|
2010-06-12 16:29:32 +00:00
|
|
|
|
2010-12-02 21:31:35 +00:00
|
|
|
public static string SparkleIconPath = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare",
|
2010-07-27 11:00:01 +00:00
|
|
|
"icons");
|
2010-05-06 00:17:00 +00:00
|
|
|
|
2010-11-27 21:23:44 +00:00
|
|
|
|
|
|
|
private static string GetGitPath ()
|
|
|
|
{
|
|
|
|
|
|
|
|
Process process = new Process ();
|
|
|
|
|
|
|
|
process.StartInfo.RedirectStandardOutput = true;
|
|
|
|
process.StartInfo.UseShellExecute = false;
|
|
|
|
process.StartInfo.FileName = "which";
|
|
|
|
process.StartInfo.Arguments = "git";
|
|
|
|
process.Start ();
|
|
|
|
|
|
|
|
string git_path = process.StandardOutput.ReadToEnd ().Trim ();
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty (git_path))
|
|
|
|
return git_path;
|
|
|
|
else
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-05-06 00:17:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|