capuchin r94 - in trunk/src: capuchin libcapuchin
- From: sebp svn gnome org
- To: svn-commits-list gnome org
- Subject: capuchin r94 - in trunk/src: capuchin libcapuchin
- Date: Wed, 13 Aug 2008 16:37:13 +0000 (UTC)
Author: sebp
Date: Wed Aug 13 16:37:13 2008
New Revision: 94
URL: http://svn.gnome.org/viewvc/capuchin?rev=94&view=rev
Log:
Store repository XML files in $XDG_CACHE_HOME/capuchin or
$HOME/.cache/capuchin. Log files are still stored in $HOME/.capuchin
Modified:
trunk/src/capuchin/Main.cs
trunk/src/libcapuchin/Globals.cs.in
Modified: trunk/src/capuchin/Main.cs
==============================================================================
--- trunk/src/capuchin/Main.cs (original)
+++ trunk/src/capuchin/Main.cs Wed Aug 13 16:37:13 2008
@@ -28,17 +28,17 @@
public static void Main(string[] args)
{
opts.ProcessArgs(args);
- CreateConfigDirIfNotExists();
+ CreateLogDirIfNotExists();
if (opts.debug)
{
- Capuchin.Logging.Log.Initialize(Capuchin.Globals.Instance.LOCAL_CONFIG_DIR,
+ Capuchin.Logging.Log.Initialize(Capuchin.Globals.Instance.LOG_FILES_DIR,
"capuchin",
Capuchin.Logging.LogLevel.Debug,
true
);
} else {
- Capuchin.Logging.Log.Initialize(Capuchin.Globals.Instance.LOCAL_CONFIG_DIR,
+ Capuchin.Logging.Log.Initialize(Capuchin.Globals.Instance.LOG_FILES_DIR,
"capuchin",
Capuchin.Logging.LogLevel.Error,
true
@@ -62,12 +62,12 @@
}
}
- private static void CreateConfigDirIfNotExists()
+ private static void CreateLogDirIfNotExists()
{
- if (!Directory.Exists(Capuchin.Globals.Instance.LOCAL_CONFIG_DIR))
+ if (!Directory.Exists(Capuchin.Globals.Instance.LOG_FILES_DIR))
{
- Capuchin.Logging.Log.Debug("Creating directory {0}", Capuchin.Globals.Instance.LOCAL_CONFIG_DIR);
- Directory.CreateDirectory(Capuchin.Globals.Instance.LOCAL_CONFIG_DIR);
+ Capuchin.Logging.Log.Debug("Creating directory {0}", Capuchin.Globals.Instance.LOG_FILES_DIR);
+ Directory.CreateDirectory(Capuchin.Globals.Instance.LOG_FILES_DIR);
}
}
Modified: trunk/src/libcapuchin/Globals.cs.in
==============================================================================
--- trunk/src/libcapuchin/Globals.cs.in (original)
+++ trunk/src/libcapuchin/Globals.cs.in Wed Aug 13 16:37:13 2008
@@ -7,16 +7,27 @@
public sealed class Globals
{
public const string GPG_BIN = "@GPG@";
- public readonly string LOCAL_CONFIG_DIR;
public readonly string LOCAL_CACHE_DIR;
+ public readonly string LOG_FILES_DIR;
public static readonly Globals Instance = new Globals();
public static readonly DownloadManager DLM = new DownloadManager();
private Globals()
- {
- this.LOCAL_CONFIG_DIR = Path.Combine ( Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".capuchin" );
- this.LOCAL_CACHE_DIR = Path.Combine (this.LOCAL_CONFIG_DIR, "cache");
+ {
+ this.LOG_FILES_DIR = Path.Combine (Environment.GetFolderPath (
+ Environment.SpecialFolder.Personal), ".capuchin");
+ this.LOCAL_CACHE_DIR = Path.Combine (GetXDGCacheDir (), "capuchin");
+ }
+
+ private static string GetXDGCacheDir () {
+ string cachedir = Environment.GetEnvironmentVariable ("XDG_CACHE_HOME");
+ if (cachedir == null) {
+ cachedir = Path.Combine (Environment.GetFolderPath (
+ Environment.SpecialFolder.Personal), ".cache" );
+ }
+
+ return cachedir;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]