From 035434468e2d8b89bfa12fac601c9a4074a5d635 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 25 Jul 2013 23:11:55 -0700 Subject: [PATCH] more linux fixes --- .../EnvironmentInfo/RuntimeInfo.cs | 31 ++++++++++++------- NzbDrone.Common/PathExtensions.cs | 2 +- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs b/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs index 0f96c0f99..f2d0e4caf 100644 --- a/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs +++ b/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.IO; using System.Security.Principal; using NLog; @@ -26,6 +27,11 @@ namespace NzbDrone.Common.EnvironmentInfo get { return Environment.UserInteractive; } } + static RuntimeInfo() + { + IsProduction = InternalIsProduction(); + } + public bool IsAdmin { get @@ -45,21 +51,22 @@ namespace NzbDrone.Common.EnvironmentInfo private static readonly string ProcessName = Process.GetCurrentProcess().ProcessName.ToLower(); - public static bool IsProduction + public static bool IsProduction { get; private set; } + + private static bool InternalIsProduction() { - get - { - if (BuildInfo.IsDebug || Debugger.IsAttached) return false; - if (BuildInfo.Version.Revision > 10000) return false; //Official builds will never have such a high revision + if (BuildInfo.IsDebug || Debugger.IsAttached) return false; + if (BuildInfo.Version.Revision > 10000) return false; //Official builds will never have such a high revision - var lowerProcessName = ProcessName.ToLower(); - if (lowerProcessName.Contains("vshost")) return false; - if (lowerProcessName.Contains("nunit")) return false; - if (lowerProcessName.Contains("jetbrain")) return false; - if (lowerProcessName.Contains("resharper")) return false; + var lowerProcessName = ProcessName.ToLower(); + if (lowerProcessName.Contains("vshost")) return false; + if (lowerProcessName.Contains("nunit")) return false; + if (lowerProcessName.Contains("jetbrain")) return false; + if (lowerProcessName.Contains("resharper")) return false; - return true; - } + if (Directory.GetCurrentDirectory().ToLower().Contains("teamcity")) return false; + + return true; } } } \ No newline at end of file diff --git a/NzbDrone.Common/PathExtensions.cs b/NzbDrone.Common/PathExtensions.cs index c555e7426..7b56faa37 100644 --- a/NzbDrone.Common/PathExtensions.cs +++ b/NzbDrone.Common/PathExtensions.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Common var info = new FileInfo(path); - if (info.FullName.StartsWith(@"\\")) //UNC + if (!OsInfo.IsLinux && info.FullName.StartsWith(@"\\")) //UNC { return info.FullName.TrimEnd('/', '\\', ' '); }