Fixed application path issue.

pull/3113/head
kay.one 13 years ago
parent 5aecd63d09
commit bb1f6649b5

@ -12,7 +12,6 @@ namespace NzbDrone.Common.Test
readonly EnviromentProvider enviromentController = new EnviromentProvider();
[Test]
public void Is_user_interactive_should_be_false()
{
enviromentController.IsUserInteractive.Should().BeTrue();
@ -41,6 +40,14 @@ namespace NzbDrone.Common.Test
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 @@ namespace NzbDrone.Common
{
get
{
var dir = new FileInfo(Environment.CurrentDirectory).Directory;
var dir = new DirectoryInfo(Environment.CurrentDirectory);
while (!ContainsIIS(dir))
{
@ -79,7 +80,7 @@ namespace NzbDrone.Common
{
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 @@ namespace NzbDrone.Common
private static bool ContainsIIS(DirectoryInfo dir)
{
return dir.GetDirectories("iisexpress").Length != 0;
return dir.GetDirectories(IIS_FOLDER_NAME).Length != 0;
}
}
}
Loading…
Cancel
Save