Skip to content

Commit

Permalink
Find the current directory
Browse files Browse the repository at this point in the history
  • Loading branch information
majorsilence committed May 21, 2016
1 parent 5622660 commit 9d77733
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ReportTests/Utils/GeneralUtils.cs
Expand Up @@ -22,17 +22,28 @@ public static Uri OutputTestsFolder()
return new Uri(System.IO.Path.Combine(tmpf, "rdlTestResults", Guid.NewGuid().ToString()));

}
public static Uri ReportsFolder(string subFoder=null)

public static Uri ReportsFolder(string subFoder = null)
{
string defaultReportsFolder = "Reports/";
string cwd = System.Environment.CurrentDirectory;
if (subFoder!=null)
string cwd = CurrentDirectory();
if (subFoder != null)
return new Uri(System.IO.Path.Combine(cwd, defaultReportsFolder, subFoder));
else
return new Uri(System.IO.Path.Combine(cwd, defaultReportsFolder));


}

static string CurrentDirectory()
{
// Works from within nunit and regular execution
var codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
var u = new UriBuilder(codeBase);

var path = Uri.UnescapeDataString(u.Path);
return System.IO.Path.GetDirectoryName(path);
}

}
}

0 comments on commit 9d77733

Please sign in to comment.