From 1fca3da27bf3c90701af92d7900fd605ec4dc783 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 31 Mar 2024 18:51:05 +0200 Subject: [PATCH] Fix #3072: Ignore resources have the same name as a namespace. --- .../ProjectDecompiler/WholeProjectDecompiler.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs b/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs index 5a22d218f..95f442d2c 100644 --- a/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs +++ b/ICSharpCode.Decompiler/CSharp/ProjectDecompiler/WholeProjectDecompiler.cs @@ -246,7 +246,18 @@ namespace ICSharpCode.Decompiler.CSharp.ProjectDecompiler { string dir = Settings.UseNestedDirectoriesForNamespaces ? CleanUpPath(ns) : CleanUpDirectoryName(ns); if (directories.Add(dir)) - Directory.CreateDirectory(Path.Combine(TargetDirectory, dir)); + { + var path = Path.Combine(TargetDirectory, dir); + try + { + Directory.CreateDirectory(path); + } + catch (IOException) + { + File.Delete(path); + Directory.CreateDirectory(path); + } + } return Path.Combine(dir, file); } }