Merge pull request #685 from abeloin/mkbundle

Added MONOMKBUNDLE preprocessor symbol for the embedded version.
pull/702/head
Luke 11 years ago
commit 068d42965a

@ -16,6 +16,12 @@ using System.Net.Security;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Reflection; 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 namespace MediaBrowser.Server.Mono
{ {
@ -27,7 +33,12 @@ namespace MediaBrowser.Server.Mono
public static void Main (string[] args) 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; var applicationPath = Assembly.GetEntryAssembly ().Location;
#endif
var appPaths = CreateApplicationPaths(applicationPath); var appPaths = CreateApplicationPaths(applicationPath);
@ -201,6 +212,19 @@ namespace MediaBrowser.Server.Mono
// Right now this method will just shutdown, but not restart // Right now this method will just shutdown, but not restart
Shutdown (); 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 class NoCheckCertificatePolicy : ICertificatePolicy

Loading…
Cancel
Save