1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-24 00:42:38 +00:00

Fixed application path issue.

This commit is contained in:
kay.one 2011-11-02 19:09:00 -07:00
parent 5aecd63d09
commit bb1f6649b5
2 changed files with 12 additions and 4 deletions

View file

@ -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()
{

View file

@ -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;
}
}
}