From 0952a5e22d9d021fb275450ea16d1b62b972af13 Mon Sep 17 00:00:00 2001 From: Sandor Nemes Date: Fri, 24 Apr 2015 07:50:52 +0200 Subject: [PATCH] Fixed a problem when one of the parent directories contains a dot. --- de4dot.code/ObfuscatedFile.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/de4dot.code/ObfuscatedFile.cs b/de4dot.code/ObfuscatedFile.cs index 817fee3f..49e2a9a9 100644 --- a/de4dot.code/ObfuscatedFile.cs +++ b/de4dot.code/ObfuscatedFile.cs @@ -151,17 +151,8 @@ namespace de4dot.code { } string GetDefaultNewFilename() { - int dotIndex = options.Filename.LastIndexOf('.'); - string noExt, ext; - if (dotIndex != -1) { - noExt = options.Filename.Substring(0, dotIndex); - ext = options.Filename.Substring(dotIndex); - } - else { - noExt = options.Filename; - ext = ""; - } - return noExt + "-cleaned" + ext; + string newFilename = Path.GetFileNameWithoutExtension(options.Filename) + "-cleaned" + Path.GetExtension(options.Filename); + return Path.Combine(Path.GetDirectoryName(options.Filename), newFilename); } public void Load(IList deobfuscators) {