check operating system for absolute path test

pull/2268/head
dkanada 5 years ago
parent a8cd963d46
commit 65e9a705d3

@ -112,7 +112,7 @@ jobs:
- job: main_test - job: main_test
displayName: Main Test displayName: Main Test
pool: pool:
vmImage: ubuntu-latest vmImage: windows-latest
steps: steps:
- checkout: self - checkout: self
clean: true clean: true

@ -448,7 +448,7 @@ namespace Emby.Server.Implementations.IO
public virtual void SetHidden(string path, bool isHidden) public virtual void SetHidden(string path, bool isHidden)
{ {
if (OperatingSystem.Id != MediaBrowser.Model.System.OperatingSystemId.Windows) if (OperatingSystem.Id != OperatingSystemId.Windows)
{ {
return; return;
} }
@ -779,7 +779,7 @@ namespace Emby.Server.Implementations.IO
public virtual void SetExecutable(string path) public virtual void SetExecutable(string path)
{ {
if (OperatingSystem.Id == MediaBrowser.Model.System.OperatingSystemId.Darwin) if (OperatingSystem.Id == OperatingSystemId.Darwin)
{ {
RunProcess("chmod", "+x \"" + path + "\"", Path.GetDirectoryName(path)); RunProcess("chmod", "+x \"" + path + "\"", Path.GetDirectoryName(path));
} }

@ -1,6 +1,8 @@
using System;
using AutoFixture; using AutoFixture;
using AutoFixture.AutoMoq; using AutoFixture.AutoMoq;
using Emby.Server.Implementations.IO; using Emby.Server.Implementations.IO;
using MediaBrowser.Model.System;
using Xunit; using Xunit;
namespace Jellyfin.Server.Implementations.Tests.IO namespace Jellyfin.Server.Implementations.Tests.IO
@ -26,7 +28,16 @@ namespace Jellyfin.Server.Implementations.Tests.IO
string expectedAbsolutePath) string expectedAbsolutePath)
{ {
var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath); var generatedPath = _sut.MakeAbsolutePath(folderPath, filePath);
Assert.Equal(expectedAbsolutePath, generatedPath);
if (MediaBrowser.Common.System.OperatingSystem.Id == OperatingSystemId.Windows)
{
var windowsPath = "d:" + generatedPath.Replace('/', '\\');
Assert.Equal(expectedAbsolutePath, windowsPath);
}
else
{
Assert.Equal(expectedAbsolutePath, generatedPath);
}
} }
} }
} }

Loading…
Cancel
Save