From bc97d325ca6edc2366f68236fd891bdb58c32b71 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Mon, 22 May 2017 10:55:15 +0100 Subject: [PATCH] Normalize Rar keys --- .../Common/Rar/Headers/FileHeader.cs | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/SharpCompress/Common/Rar/Headers/FileHeader.cs b/src/SharpCompress/Common/Rar/Headers/FileHeader.cs index b870ed845..f0359a244 100644 --- a/src/SharpCompress/Common/Rar/Headers/FileHeader.cs +++ b/src/SharpCompress/Common/Rar/Headers/FileHeader.cs @@ -165,25 +165,13 @@ private static string ConvertPath(string path, HostOS os) #if NO_FILE return path.Replace('\\', '/'); #else - switch (os) + if (Path.DirectorySeparatorChar == '/') { - case HostOS.MacOS: - case HostOS.Unix: - { - if (Path.DirectorySeparatorChar == '\\') - { - return path.Replace('/', '\\'); - } - } - break; - default: - { - if (Path.DirectorySeparatorChar == '/') - { - return path.Replace('\\', '/'); - } - } - break; + return path.Replace('\\', '/'); + } + else if (Path.DirectorySeparatorChar == '\\') + { + return path.Replace('/', '\\'); } return path; #endif