summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMark Jansen <learn0more@gmail.com>2017-04-01 09:32:35 +0200
committerTingPing <tingping@tingping.se>2017-04-04 13:22:45 -0400
commit552b2b1315b45286b063e99510d6d6cb1b6f7575 (patch)
tree19cf9154986c5475fda295c47d6163fd50145dac /src
parenta524adc698d34f1aeec11c6dbb11573123fc5891 (diff)
thememan: Check for portable-mode file in the application directory.
Fixes #1902
Diffstat (limited to 'src')
-rw-r--r--src/htm/Main.cs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/htm/Main.cs b/src/htm/Main.cs
index 884b23f8..aecfa1ce 100644
--- a/src/htm/Main.cs
+++ b/src/htm/Main.cs
@@ -42,13 +42,27 @@ namespace thememan
 

         OpenFileDialog importDialog;

 

+        static bool IsPortable(out string directory)

+        {

+            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();

+            directory = asm != null ? asm.Location : string.Empty;

+            if (string.IsNullOrEmpty(directory))

+            {

+                directory = string.Empty;

+                return File.Exists("portable-mode");

+            }

+            directory = Path.GetDirectoryName(directory);

+            return File.Exists(Path.Combine(directory, "portable-mode"));

+        }

+

         public HTM ()

         {

             InitializeComponent ();

+            string portableDir;

 

-            if (RunningOnWindows() && File.Exists("portable-mode"))

+            if (RunningOnWindows() && IsPortable(out portableDir))

             {

-                hexchatdir = ("config\\");

+                hexchatdir = Path.Combine(portableDir, "config\\");

 

                 if (!Directory.Exists(hexchatdir))

                 {