mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
Fixed application path issue.
This commit is contained in:
parent
5aecd63d09
commit
bb1f6649b5
@ -12,7 +12,6 @@ public class EnviromentProviderTest
|
||||
readonly EnviromentProvider enviromentController = new EnviromentProvider();
|
||||
|
||||
[Test]
|
||||
|
||||
public void Is_user_interactive_should_be_false()
|
||||
{
|
||||
enviromentController.IsUserInteractive.Should().BeTrue();
|
||||
@ -41,6 +40,14 @@ public void ApplicationPath_should_not_be_empty()
|
||||
Path.IsPathRooted(enviromentController.ApplicationPath).Should().BeTrue("Path is not rooted");
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void ApplicationPath_should_find_iis_in_current_folder()
|
||||
{
|
||||
Directory.CreateDirectory(EnviromentProvider.IIS_FOLDER_NAME);
|
||||
enviromentController.ApplicationPath.Should().BeEquivalentTo(Directory.GetCurrentDirectory());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsProduction_should_return_false_when_run_within_nunit()
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ namespace NzbDrone.Common
|
||||
{
|
||||
public class EnviromentProvider
|
||||
{
|
||||
public const string IIS_FOLDER_NAME = "iisexpress";
|
||||
|
||||
#if DEBUG
|
||||
private static readonly bool isInDebug = true;
|
||||
@ -45,7 +46,7 @@ public virtual string ApplicationPath
|
||||
{
|
||||
get
|
||||
{
|
||||
var dir = new FileInfo(Environment.CurrentDirectory).Directory;
|
||||
var dir = new DirectoryInfo(Environment.CurrentDirectory);
|
||||
|
||||
while (!ContainsIIS(dir))
|
||||
{
|
||||
@ -79,7 +80,7 @@ public virtual string AppDataPath
|
||||
{
|
||||
get
|
||||
{
|
||||
var path = Path.Combine(WebRoot, "App_data");
|
||||
var path = Path.Combine(WebRoot, "App_Data");
|
||||
if (!Directory.Exists(path))
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
@ -121,7 +122,7 @@ public virtual String TempPath
|
||||
|
||||
private static bool ContainsIIS(DirectoryInfo dir)
|
||||
{
|
||||
return dir.GetDirectories("iisexpress").Length != 0;
|
||||
return dir.GetDirectories(IIS_FOLDER_NAME).Length != 0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user