diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-31 10:03:23 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-31 10:03:23 -0400 |
| commit | 6c8d9192985036acb3d1fe626ed57980bb862d6a (patch) | |
| tree | 94d59b266b877bf0b073c5e3291cb2822dc055f7 /MediaBrowser.Server.Mono/Program.cs | |
| parent | 579b507f7fa322fdf8a746b6e787015d0567e2a6 (diff) | |
replace file system calls with IFileSystem when needed
Diffstat (limited to 'MediaBrowser.Server.Mono/Program.cs')
| -rw-r--r-- | MediaBrowser.Server.Mono/Program.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 6d3cbcf26..057a2456f 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -17,6 +17,7 @@ using System.Security.Cryptography.X509Certificates; using Gtk; using Gdk; using System.Threading.Tasks; +using System.Reflection; namespace MediaBrowser.Server.Mono { @@ -203,6 +204,8 @@ namespace MediaBrowser.Server.Mono logger.Info("Server: {0}", Environment.MachineName); logger.Info("Operating system: {0}", Environment.OSVersion.ToString()); + + MonoBug11817WorkAround.Apply (); } /// <summary> @@ -280,4 +283,34 @@ namespace MediaBrowser.Server.Mono return true; } } + + public class MonoBug11817WorkAround + { + public static void Apply() + { + var property = typeof(TimeZoneInfo).GetProperty("TimeZoneDirectory", BindingFlags.Static | BindingFlags.NonPublic); + + if (property == null) return; + + var zoneInfo = FindZoneInfoFolder(); + property.SetValue(null, zoneInfo, new object[0]); + } + + public static string FindZoneInfoFolder() + { + var current = new DirectoryInfo(Directory.GetCurrentDirectory()); + + while(current != null) + { + var zoneinfoTestPath = Path.Combine(current.FullName, "zoneinfo"); + + if (Directory.Exists(zoneinfoTestPath)) + return zoneinfoTestPath; + + current = current.Parent; + } + + return null; + } + } } |
