mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 17:44:43 +01:00
replace file system calls with IFileSystem when needed
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user