From d0685a534a182e9aacc7c3cd23133807eb111508 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 11 Apr 2020 11:44:14 +1000 Subject: [PATCH] fix CodeBase locations scrubbing on mac (#88) --- src/Verify/Serialization/Scrubbers/CodeBaseLocation.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Verify/Serialization/Scrubbers/CodeBaseLocation.cs b/src/Verify/Serialization/Scrubbers/CodeBaseLocation.cs index 1ac1eeaff1..763a0fecc0 100644 --- a/src/Verify/Serialization/Scrubbers/CodeBaseLocation.cs +++ b/src/Verify/Serialization/Scrubbers/CodeBaseLocation.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; static class CodeBaseLocation { @@ -6,11 +7,8 @@ static CodeBaseLocation() { var assembly = typeof(CodeBaseLocation).Assembly; - var path = assembly.CodeBase - .Replace("file:///", "") - .Replace("file://", "") - .Replace(@"file:\\\", "") - .Replace(@"file:\\", ""); + var uri = new UriBuilder(assembly.CodeBase); + var path = Uri.UnescapeDataString(uri.Path); CurrentDirectory = Path.GetDirectoryName(path); }