From 4f1f05537734d8d3d96b2760225c8a52de54b746 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 15 Nov 2010 17:04:52 -0800 Subject: [PATCH] Deleting specflow folders only if they exist --HG-- branch : dev --- src/Orchard.Specs/Bindings/WebAppHosting.cs | 4 +++- src/Orchard.Specs/Hosting/WebHost.cs | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs index 095a78adc..41ff6f62e 100644 --- a/src/Orchard.Specs/Bindings/WebAppHosting.cs +++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs @@ -31,7 +31,9 @@ namespace Orchard.Specs.Bindings { [BeforeTestRun] public static void BeforeTestRun() { - _orchardTemp.Delete(true).CreateDirectory(); + if ( _orchardTemp.Exists ) { + _orchardTemp.Delete(true).CreateDirectory(); + } } [AfterTestRun] diff --git a/src/Orchard.Specs/Hosting/WebHost.cs b/src/Orchard.Specs/Hosting/WebHost.cs index 4cb5bef90..d2158b64b 100644 --- a/src/Orchard.Specs/Hosting/WebHost.cs +++ b/src/Orchard.Specs/Hosting/WebHost.cs @@ -24,7 +24,12 @@ namespace Orchard.Specs.Hosting { public void Initialize(string templateName, string virtualDirectory) { var baseDir = Path.Get(AppDomain.CurrentDomain.BaseDirectory); - _tempSite = Path.Get(_orchardTemp).Combine(System.IO.Path.GetRandomFileName()).Delete().CreateDirectory(); + _tempSite = Path.Get(_orchardTemp).Combine(System.IO.Path.GetRandomFileName()); + if(_tempSite.Exists) { + _tempSite.Delete(); + } + + _tempSite.CreateDirectory(); // Trying the two known relative paths to the Orchard.Web directory. // The second one is for the target "spec" in orchard.proj.