diff options
| author | Andrew Rabert <6550543+nvllsvm@users.noreply.github.com> | 2019-01-09 22:08:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-09 22:08:58 -0500 |
| commit | 3d867c2c46cec39b669bb8647efef677f32b8a8d (patch) | |
| tree | 27b625d8f61e7b120494d0934da27a9b31bcef43 /Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs | |
| parent | 7a832045d6c166bdd59fd43d0166ca309a19193b (diff) | |
| parent | f520ddc9662ec65538374d40f516c5fe6c67bb16 (diff) | |
Merge pull request #516 from Bond-009/env
Remove useless properties from IEnvironmentInfo
Diffstat (limited to 'Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs')
| -rw-r--r-- | Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs index faaed482a..d82d2f2fb 100644 --- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs +++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs @@ -44,13 +44,13 @@ namespace IsoMounter _logger.LogDebug( "[{0}] System PATH is currently set to [{1}].", Name, - EnvironmentInfo.GetEnvironmentVariable("PATH") ?? "" + Environment.GetEnvironmentVariable("PATH") ?? "" ); _logger.LogDebug( "[{0}] System path separator is [{1}].", Name, - EnvironmentInfo.PathSeparator + Path.PathSeparator ); _logger.LogDebug( @@ -118,25 +118,27 @@ namespace IsoMounter public bool CanMount(string path) { - if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Linux) { - _logger.LogInformation( - "[{0}] Checking we can attempt to mount [{1}], Extension = [{2}], Operating System = [{3}], Executables Available = [{4}].", - Name, - path, - Path.GetExtension(path), - EnvironmentInfo.OperatingSystem, - ExecutablesAvailable.ToString() - ); - - if (ExecutablesAvailable) { - return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase); - } else { - return false; - } - } else { + if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Linux) + { return false; } + _logger.LogInformation( + "[{0}] Checking we can attempt to mount [{1}], Extension = [{2}], Operating System = [{3}], Executables Available = [{4}].", + Name, + path, + Path.GetExtension(path), + EnvironmentInfo.OperatingSystem, + ExecutablesAvailable.ToString() + ); + if (ExecutablesAvailable) + { + return string.Equals(Path.GetExtension(path), ".iso", StringComparison.OrdinalIgnoreCase); + } + else + { + return false; + } } public Task Install(CancellationToken cancellationToken) @@ -211,18 +213,16 @@ namespace IsoMounter private string GetFullPathForExecutable(string name) { - foreach (string test in (EnvironmentInfo.GetEnvironmentVariable("PATH") ?? "").Split(EnvironmentInfo.PathSeparator)) { - + foreach (string test in (Environment.GetEnvironmentVariable("PATH") ?? "").Split(Path.PathSeparator)) + { string path = test.Trim(); if (!String.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name))) { return FileSystem.GetFullPath(path); } - } - return String.Empty; - + return string.Empty; } private uint GetUID() @@ -315,9 +315,9 @@ namespace IsoMounter ); } else { - + throw new ArgumentNullException(nameof(isoPath)); - + } try @@ -397,9 +397,9 @@ namespace IsoMounter ); } else { - + throw new ArgumentNullException(nameof(mount)); - + } if (GetUID() == 0) { @@ -444,7 +444,7 @@ namespace IsoMounter } #endregion - + #region Internal Methods internal void OnUnmount(LinuxMount mount) |
