Skip to content

Commit

Permalink
scrub temp dir
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Dec 27, 2019
1 parent a5b3d1d commit f31a8c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;CS0649</NoWarn>
<Version>1.4.1</Version>
<Version>1.5.0</Version>
<PackageTags>Json, Testing, Verify</PackageTags>
<Description>Enables simple verification of complex models.</Description>
</PropertyGroup>
Expand Down
5 changes: 5 additions & 0 deletions src/Verify/ApplyScrubbers.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
using System;
using System.Collections.Generic;
using System.IO;
using Verify;

static class ApplyScrubbers
{
static HashSet<string> currentDirectoryReplacements = new HashSet<string>();
static string tempPath;

static ApplyScrubbers()
{
currentDirectoryReplacements.Add(CleanPath(AppDomain.CurrentDomain.BaseDirectory));
currentDirectoryReplacements.Add(CleanPath(Environment.CurrentDirectory));
currentDirectoryReplacements.Add(CleanPath(CodeBaseLocation.CurrentDirectory));
tempPath = CleanPath(Path.GetTempPath());
}

public static string Apply(string target, List<Func<string, string>> scrubbers)
Expand All @@ -20,6 +23,8 @@ public static string Apply(string target, List<Func<string, string>> scrubbers)
target = target.Replace(replace, "CurrentDirectory");
}

target = target.Replace(tempPath, "TempPath");

foreach (var scrubber in scrubbers)
{
target = scrubber(target);
Expand Down

0 comments on commit f31a8c9

Please sign in to comment.