diff options
| author | Luke <luke.pulverenti@gmail.com> | 2014-01-22 20:19:27 -0800 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2014-01-22 20:19:27 -0800 |
| commit | 068d42965af6e7b78484068cb1c56da484a73f92 (patch) | |
| tree | b81d4161bc184ecf0ffd9abeb088daeee38498ee | |
| parent | 6cfc103bd3112e0a91e1c9154261f62cdee4525f (diff) | |
| parent | 8f28fa427c6ef4e31c0530491ee23b6f6bf034b6 (diff) | |
Merge pull request #685 from abeloin/mkbundle
Added MONOMKBUNDLE preprocessor symbol for the embedded version.
| -rw-r--r-- | MediaBrowser.Server.Mono/Program.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index c65711704..7afe0ce03 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -16,6 +16,12 @@ using System.Net.Security; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; using System.Reflection; +// MONOMKBUNDLE: For the embedded version, mkbundle tool +#if MONOMKBUNDLE +using Mono.Unix; +using Mono.Unix.Native; +using System.Text; +#endif namespace MediaBrowser.Server.Mono { @@ -27,7 +33,12 @@ namespace MediaBrowser.Server.Mono public static void Main (string[] args) { + //GetEntryAssembly is empty when running from a mkbundle package + #if MONOMKBUNDLE + var applicationPath = GetExecutablePath(); + #else var applicationPath = Assembly.GetEntryAssembly ().Location; + #endif var appPaths = CreateApplicationPaths(applicationPath); @@ -201,6 +212,19 @@ namespace MediaBrowser.Server.Mono // Right now this method will just shutdown, but not restart Shutdown (); } + + // Return the running process path + #if MONOMKBUNDLE + public static string GetExecutablePath() + { + var builder = new StringBuilder (8192); + if (Syscall.readlink("/proc/self/exe", builder) >= 0) + return builder.ToString (); + else + return null; + } + #endif + } class NoCheckCertificatePolicy : ICertificatePolicy |
