[chronojump] Get prefix directory correctly



commit f1ddbd37943f61d316d5d65f93f7693b8df20fae
Author: Windows Build <windows chronojump org>
Date:   Thu Feb 27 17:05:38 2014 +0100

    Get prefix directory correctly

 src/chronojump.cs |    5 +----
 src/util.cs       |   11 +++++------
 2 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/src/chronojump.cs b/src/chronojump.cs
index ab10259..9412345 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -73,10 +73,7 @@ public class ChronoJump
 
                
                var envPath = Environment.GetEnvironmentVariable ("PATH");
-               baseDirectory = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "..");
-               if (!Directory.Exists(Path.Combine (baseDirectory, "chronojump"))) {
-                       baseDirectory = System.IO.Path.Combine(baseDirectory, "..");
-               }
+               baseDirectory = Util.GetPrefixDir();
                if(UtilAll.IsWindows()) {
                        Environment.SetEnvironmentVariable ("R_HOME", RelativeToPrefix ("library"));
                } else {
diff --git a/src/util.cs b/src/util.cs
index b377441..195cc25 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -834,12 +834,11 @@ public class Util
        }
 
        public static string GetPrefixDir(){
-               string runningFolder = System.AppDomain.CurrentDomain.BaseDirectory;
-               if (Environment.OSVersion.Platform == PlatformID.Win32NT)       
-                       return System.IO.Path.Combine(runningFolder, ".." + Path.DirectorySeparatorChar);
-               else 
-                       return System.IO.Path.Combine(runningFolder,
-                               ".." + Path.DirectorySeparatorChar + ".." + Path.DirectorySeparatorChar);
+               string baseDirectory = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, 
"..");
+               if (!Directory.Exists(Path.Combine (baseDirectory, "lib", "chronojump"))) {
+                       baseDirectory = System.IO.Path.Combine(baseDirectory, "..");
+               }
+               return baseDirectory;
        }
 
        public static string GetDataDir(){


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]