From 349a6b095302cbdfeaabe2b35c3d6f271af2e852 Mon Sep 17 00:00:00 2001
From: samwiddowson <36040364+samwiddowson@users.noreply.github.com>
Date: Tue, 9 Jul 2024 18:47:24 +0100
Subject: [PATCH] Fixed a crash when adding opening the dialog to add a
 directory resource on Mono Winforms

---
 Source/Core/Controls/FolderSelectDialog.cs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Source/Core/Controls/FolderSelectDialog.cs b/Source/Core/Controls/FolderSelectDialog.cs
index 9c80ef62a..b20c89552 100755
--- a/Source/Core/Controls/FolderSelectDialog.cs
+++ b/Source/Core/Controls/FolderSelectDialog.cs
@@ -283,6 +283,7 @@ namespace CodeImp.DoomBuilder.Controls
         {
             bool flag = false;
 
+#if !MONO_WINFORMS
             if (Environment.OSVersion.Version.Major >= 6)
             {
                 var r = new Reflector("System.Windows.Forms");
@@ -313,6 +314,7 @@ namespace CodeImp.DoomBuilder.Controls
             }
             else
             {
+#endif
                 var fbd = new FolderBrowserDialog();
                 fbd.Description = this.Title;
                 fbd.SelectedPath = this.InitialDirectory;
@@ -320,7 +322,9 @@ namespace CodeImp.DoomBuilder.Controls
                 if (fbd.ShowDialog(new WindowWrapper(hWndOwner)) != DialogResult.OK) return false;
                 ofd.FileName = fbd.SelectedPath;
                 flag = true;
+#if !MONO_WINFORMS
             }
+#endif
 
             return flag;
         }
-- 
GitLab