Deleting specflow folders only if they exist

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-11-15 17:04:52 -08:00
parent 000667480b
commit 4f1f055377
2 changed files with 9 additions and 2 deletions

View File

@@ -31,7 +31,9 @@ namespace Orchard.Specs.Bindings {
[BeforeTestRun] [BeforeTestRun]
public static void BeforeTestRun() { public static void BeforeTestRun() {
_orchardTemp.Delete(true).CreateDirectory(); if ( _orchardTemp.Exists ) {
_orchardTemp.Delete(true).CreateDirectory();
}
} }
[AfterTestRun] [AfterTestRun]

View File

@@ -24,7 +24,12 @@ namespace Orchard.Specs.Hosting {
public void Initialize(string templateName, string virtualDirectory) { public void Initialize(string templateName, string virtualDirectory) {
var baseDir = Path.Get(AppDomain.CurrentDomain.BaseDirectory); 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. // Trying the two known relative paths to the Orchard.Web directory.
// The second one is for the target "spec" in orchard.proj. // The second one is for the target "spec" in orchard.proj.