more linux fixes

pull/3113/head
kay.one 11 years ago
parent c2b4eadc47
commit 67661c6893

@ -1,4 +1,5 @@
using System.IO; using System.Diagnostics;
using System.IO;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
@ -30,7 +31,7 @@ namespace NzbDrone.Common.Test
[Test] [Test]
public void IsProduction_should_return_false_when_run_within_nunit() public void IsProduction_should_return_false_when_run_within_nunit()
{ {
RuntimeInfo.IsProduction.Should().BeFalse(); RuntimeInfo.IsProduction.Should().BeFalse("Process name is " + Process.GetCurrentProcess().ProcessName);
} }
} }
} }

@ -394,6 +394,11 @@ namespace NzbDrone.Common
public void SetPermissions(string filename, string account, FileSystemRights rights, AccessControlType controlType) public void SetPermissions(string filename, string account, FileSystemRights rights, AccessControlType controlType)
{ {
try
{
var directoryInfo = new DirectoryInfo(filename); var directoryInfo = new DirectoryInfo(filename);
var directorySecurity = directoryInfo.GetAccessControl(); var directorySecurity = directoryInfo.GetAccessControl();
@ -405,6 +410,13 @@ namespace NzbDrone.Common
directorySecurity.AddAccessRule(accessRule); directorySecurity.AddAccessRule(accessRule);
directoryInfo.SetAccessControl(directorySecurity); directoryInfo.SetAccessControl(directorySecurity);
} }
catch (Exception e)
{
Logger.WarnException(string.Format("Couldn't set permission for {0}. account:{1} rights:{2} accessControlType:{3}", filename, account, rights, controlType), e);
throw;
}
}
public bool IsParent(string parent, string subfolder) public bool IsParent(string parent, string subfolder)
{ {

@ -11,7 +11,8 @@ namespace NzbDrone.Test.Common
{ {
if (path.Length > 2 && path[1] == ':') if (path.Length > 2 && path[1] == ':')
{ {
path = path.Replace(':', Path.DirectorySeparatorChar); path = path.Replace(":", "");
path = Path.DirectorySeparatorChar + path;
} }
path = path.Replace("\\", Path.DirectorySeparatorChar.ToString()); path = path.Replace("\\", Path.DirectorySeparatorChar.ToString());
} }

Loading…
Cancel
Save