[longomatch] Move data dir configuration to the init function
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Move data dir configuration to the init function
- Date: Wed, 24 Sep 2014 20:30:03 +0000 (UTC)
commit f5fa694977f38bbda008b9a9dc0f826213a9ce0d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu Sep 11 23:45:59 2014 +0200
Move data dir configuration to the init function
LongoMatch.Services/Services/CoreServices.cs | 19 +++++++++++++------
LongoMatch/Main.cs | 17 ++++-------------
2 files changed, 17 insertions(+), 19 deletions(-)
---
diff --git a/LongoMatch.Services/Services/CoreServices.cs b/LongoMatch.Services/Services/CoreServices.cs
index 7e99dcf..b38edf7 100644
--- a/LongoMatch.Services/Services/CoreServices.cs
+++ b/LongoMatch.Services/Services/CoreServices.cs
@@ -133,13 +133,20 @@ namespace LongoMatch.Services
static void SetupBaseDir ()
{
string home;
-
- Config.baseDirectory = System.IO.Path.Combine
(System.AppDomain.CurrentDomain.BaseDirectory, "../");
- if (!System.IO.Directory.Exists (System.IO.Path.Combine (Config.baseDirectory,
"share", Constants.SOFTWARE_NAME))) {
- Config.baseDirectory = System.IO.Path.Combine (Config.baseDirectory, "../");
+
+ if (Environment.GetEnvironmentVariable ("LGM_UNINSTALLED") != null) {
+ Config.baseDirectory = ".";
+ Config.dataDir = "../data";
+ } else {
+ Config.baseDirectory = System.IO.Path.Combine
(System.AppDomain.CurrentDomain.BaseDirectory, "../");
+ if (!System.IO.Directory.Exists (System.IO.Path.Combine
(Config.baseDirectory, "share", Constants.SOFTWARE_NAME))) {
+ Config.baseDirectory = System.IO.Path.Combine (Config.baseDirectory,
"../");
+ }
+ if (!System.IO.Directory.Exists (System.IO.Path.Combine
(Config.baseDirectory, "share", Constants.SOFTWARE_NAME)))
+ Log.Warning ("Prefix directory not found");
+ Config.dataDir = Path.Combine (Config.baseDirectory, "share",
+ Constants.SOFTWARE_NAME.ToLower ());
}
- if (!System.IO.Directory.Exists (System.IO.Path.Combine (Config.baseDirectory,
"share", Constants.SOFTWARE_NAME)))
- Log.Warning ("Prefix directory not found");
/* Check for the magic file PORTABLE to check if it's a portable version
* and the config goes in the same folder as the binaries */
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 8cdc543..bbf18c2 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -86,28 +86,19 @@ namespace LongoMatch
static void InitGtk ()
{
- string dataDir, gtkRC, iconsDir, styleConf;
- IconTheme theme;
+ string gtkRC, iconsDir, styleConf;
- if (Environment.GetEnvironmentVariable ("LGM_UNINSTALLED") != null) {
- dataDir = "../data";
- } else {
- dataDir = Path.Combine (Config.baseDirectory, "share",
- Constants.SOFTWARE_NAME.ToLower ());
- }
- Config.dataDir = dataDir;
-
- gtkRC = Path.Combine (dataDir, "theme", "gtk-2.0", "gtkrc");
+ gtkRC = Path.Combine (Config.dataDir, "theme", "gtk-2.0", "gtkrc");
if (File.Exists (gtkRC)) {
Rc.AddDefaultFile (gtkRC);
}
- styleConf = Path.Combine (dataDir, "theme", "longomatch-dark.json");
+ styleConf = Path.Combine (Config.dataDir, "theme", "longomatch-dark.json");
Config.Style = StyleConf.Load (styleConf);
Application.Init ();
- iconsDir = Path.Combine (dataDir, "icons");
+ iconsDir = Path.Combine (Config.dataDir, "icons");
if (Directory.Exists (iconsDir)) {
IconTheme.Default.PrependSearchPath (iconsDir);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]