[smuxi] Engine: added mkbundle support (closes: #963)



commit c4c516e0bfc40ee84f4d01c27242cf356042832d
Author: Mirco Bauer <meebey meebey net>
Date:   Tue Apr 29 21:00:03 2014 +0200

    Engine: added mkbundle support (closes: #963)

 src/Engine/Engine.cs |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/Engine/Engine.cs b/src/Engine/Engine.cs
index e9a62f7..5a3f4b5 100644
--- a/src/Engine/Engine.cs
+++ b/src/Engine/Engine.cs
@@ -28,6 +28,7 @@
 
 using System;
 using System.IO;
+using System.Text;
 using System.Reflection;
 using Smuxi.Common;
 
@@ -110,10 +111,18 @@ namespace Smuxi.Engine
             _Config = new Config();
             _Config.Load();
             _Config.Save();
-            
-            string location = Assembly.GetExecutingAssembly().Location;
+
+            string location = Path.GetDirectoryName(asm.Location);
+            if (String.IsNullOrEmpty(location) &&
+                Environment.OSVersion.Platform == PlatformID.Unix) {
+                // we are mkbundled
+                var locationBuilder = new StringBuilder(8192);
+                if (Mono.Unix.Native.Syscall.readlink("/proc/self/exe", locationBuilder) >= 0) {
+                    location = Path.GetDirectoryName(locationBuilder.ToString());
+                }
+            }
             _ProtocolManagerFactory = new ProtocolManagerFactory();
-            _ProtocolManagerFactory.LoadAllProtocolManagers(Path.GetDirectoryName(location));
+            _ProtocolManagerFactory.LoadAllProtocolManagers(location);
             
             _SessionManager = new SessionManager(_Config, _ProtocolManagerFactory);
         }


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