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) {