From 5a5cb218eae4601aa244c387f38dce624c346b85 Mon Sep 17 00:00:00 2001
From: Jan Wichmann <j-wichmann@gmx.net>
Date: Sat, 10 Feb 2024 17:28:39 +0000
Subject: [PATCH] Let pl_editor launch in run from builddir env on windows

---
 .gitignore          |  1 +
 common/gestfich.cpp | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/.gitignore b/.gitignore
index 812a3e0fce..175b255b74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -103,6 +103,7 @@ __pycache__
 .editorconfig
 CMakeSettings.json
 .vscode/
+/vcpkg_installed
 
 # Sublime Text
 *.sublime-*
diff --git a/common/gestfich.cpp b/common/gestfich.cpp
index c26f492978..4641e649a4 100644
--- a/common/gestfich.cpp
+++ b/common/gestfich.cpp
@@ -68,7 +68,17 @@ wxString FindKicadFile( const wxString& shortname )
     {
         wxFileName buildDir( Pgm().GetExecutablePath(), shortname );
         buildDir.RemoveLastDir();
+#ifndef __WXMSW__
         buildDir.AppendDir( shortname );
+#else
+        buildDir.AppendDir( shortname.BeforeLast( '.' ) );
+#endif
+
+        if( buildDir.GetDirs().Last() == "pl_editor" )
+        {
+            buildDir.RemoveLastDir();
+            buildDir.AppendDir( "pagelayout_editor" );
+        }
 
         if( wxFileExists( buildDir.GetFullPath() ) )
             return buildDir.GetFullPath();