From 5b0aaad1563fb44d61b0dc4a9c4852d43cd17f0c Mon Sep 17 00:00:00 2001
From: stahta01 <stahta01@users.noreply.github.com>
Date: Sun, 2 Nov 2025 23:40:20 -0500
Subject: Change more of the installation file layout to match Linux under
 Posix layout (#3737)

---
 CMakeLists.txt                       | 17 ++++++++++-------
 CodeLite/CMakeLists.txt              |  4 ++--
 DatabaseExplorer/CMakeLists.txt      |  8 ++++----
 LiteEditor/app.cpp                   |  8 ++++++++
 Plugin/CMakeLists.txt                |  4 ++--
 sdk/wxsqlite3/CMakeLists.txt         |  4 ++--
 wxcrafter/src/wxgui_bitmaploader.cpp |  5 +++++
 7 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d241baf3..44e13d673 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -335,10 +335,13 @@ if(MINGW)
   # MinGW
   if(WITH_POSIX_LAYOUT)
     set(MINGW_INSTALL_PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/lib/codelite")
+    set(MINGW_INSTALL_BIN "${CMAKE_INSTALL_PREFIX}/bin")
+    set(MINGW_INSTALL_RESOURCES_DIR "${CMAKE_INSTALL_PREFIX}/share/codelite")
   else()
     set(MINGW_INSTALL_PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/plugins")
+    set(MINGW_INSTALL_BIN "${CMAKE_INSTALL_PREFIX}")
+    set(MINGW_INSTALL_RESOURCES_DIR "${MINGW_INSTALL_BIN}")
   endif()
-  set(MINGW_INSTALL_BIN "${CMAKE_INSTALL_PREFIX}")
 endif()
 
 if(APPLE)
@@ -349,7 +352,7 @@ if(APPLE)
 elseif(MINGW)
   set(PLUGINS_DIR "${MINGW_INSTALL_PLUGINS_DIR}")
   set(CL_INSTALL_BIN "${MINGW_INSTALL_BIN}")
-  set(CL_RESOURCES_DIR "${MINGW_INSTALL_BIN}")
+  set(CL_RESOURCES_DIR "${MINGW_INSTALL_RESOURCES_DIR}")
 else()
   # /usr/lib/codelite
   set(PLUGINS_DIR "${CL_PREFIX}/${CL_INSTALL_LIBDIR}/codelite")
@@ -1194,16 +1197,16 @@ if(MINGW)
 
   foreach(DLL ${SYSTEM_DLLS})
     install(FILES "${MSYS2_BASE}/clang64/bin/${DLL}"
-            DESTINATION "${CMAKE_INSTALL_PREFIX}")
+            DESTINATION "${CL_INSTALL_BIN}")
   endforeach()
 
   foreach(DLL ${MSYS2_CORE_FILES})
     install(FILES "${MSYS2_BASE}/usr/bin/${DLL}"
-            DESTINATION "${CMAKE_INSTALL_PREFIX}")
+            DESTINATION "${CL_INSTALL_BIN}")
   endforeach()
 
   foreach(DLL ${WXWIDGETS_DLLS})
-    install(FILES "${DLL}" DESTINATION "${CMAKE_INSTALL_PREFIX}")
+    install(FILES "${DLL}" DESTINATION "${CL_INSTALL_BIN}")
   endforeach()
 
   foreach(RESOURCE ${CODELITE_RESOURCES})
@@ -1212,11 +1215,11 @@ if(MINGW)
 
   # copy extra deps dlls
   foreach(DLL ${LIBHUNSPELL_DEPS})
-    install(FILES "${DLL}" DESTINATION "${CMAKE_INSTALL_PREFIX}")
+    install(FILES "${DLL}" DESTINATION "${CL_INSTALL_BIN}")
   endforeach()
 
   foreach(DLL ${LIBSSH_DEPS})
-    install(FILES "${DLL}" DESTINATION "${CMAKE_INSTALL_PREFIX}")
+    install(FILES "${DLL}" DESTINATION "${CL_INSTALL_BIN}")
   endforeach()
 
   foreach(DLL ${OPENSSL_DEPS})
diff --git a/CodeLite/CMakeLists.txt b/CodeLite/CMakeLists.txt
index 4731e147e..73cf4af0f 100644
--- a/CodeLite/CMakeLists.txt
+++ b/CodeLite/CMakeLists.txt
@@ -132,8 +132,8 @@ if(NOT MINGW)
 else()
   install(
     TARGETS libcodelite
-    RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
-    LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}
+    RUNTIME DESTINATION ${CL_INSTALL_BIN}
+    LIBRARY DESTINATION ${CL_INSTALL_BIN}
     ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
 endif()
 
diff --git a/DatabaseExplorer/CMakeLists.txt b/DatabaseExplorer/CMakeLists.txt
index 306a645e4..f0d5fea50 100644
--- a/DatabaseExplorer/CMakeLists.txt
+++ b/DatabaseExplorer/CMakeLists.txt
@@ -19,10 +19,10 @@ if(WITH_MYSQL)
     add_compile_definitions(DBL_USE_MYSQL=1)
 
     if(MINGW)
-        install(FILES "${MSYS2_BASE}/clang64/bin/libmariadb.dll" DESTINATION "${CMAKE_INSTALL_PREFIX}")
+        install(FILES "${MSYS2_BASE}/clang64/bin/libmariadb.dll" DESTINATION "${CL_INSTALL_BIN}")
         msys_list_deps(${MSYS2_BASE}/clang64/bin/libmariadb.dll LIBMARIA_DEPS)
         foreach(DEP ${LIBMARIA_DEPS})
-            install(FILES "${DEP}" DESTINATION "${CMAKE_INSTALL_PREFIX}")
+            install(FILES "${DEP}" DESTINATION "${CL_INSTALL_BIN}")
         endforeach()
     endif()
     unset(WITH_MYSQL CACHE)
@@ -34,10 +34,10 @@ if(WITH_POSTGRES)
     add_compile_definitions(DBL_USE_POSTGRES=1)
 
     if(MINGW)
-        install(FILES "${MSYS2_BASE}/clang64/bin/libpq.dll" DESTINATION "${CMAKE_INSTALL_PREFIX}")
+        install(FILES "${MSYS2_BASE}/clang64/bin/libpq.dll" DESTINATION "${CL_INSTALL_BIN}")
         msys_list_deps(${MSYS2_BASE}/clang64/bin/libpq.dll LIBPOSTGRES_DEPS)
         foreach(DEP ${LIBPOSTGRES_DEPS})
-            install(FILES "${DEP}" DESTINATION "${CMAKE_INSTALL_PREFIX}")
+            install(FILES "${DEP}" DESTINATION "${CL_INSTALL_BIN}")
         endforeach()
     endif()
 endif()
diff --git a/LiteEditor/app.cpp b/LiteEditor/app.cpp
index 483675622..f2ce69a6c 100644
--- a/LiteEditor/app.cpp
+++ b/LiteEditor/app.cpp
@@ -508,7 +508,15 @@ bool CodeLiteApp::OnInit()
         }
         homeDir = bd.GetPath();
     } else {
+#ifdef USE_POSIX_LAYOUT
+        wxFileName execfpath(clStandardPaths::Get().GetExecutablePath());
+        if (execfpath.GetDirs().Last().IsSameAs("bin")) {
+            execfpath.RemoveLastDir();
+        }
+        homeDir = execfpath.GetPath() + wxT("/share/codelite");
+#else
         homeDir = wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath();
+#endif
     }
     clStandardPaths::Get().SetDataDir(homeDir);
 #endif
diff --git a/Plugin/CMakeLists.txt b/Plugin/CMakeLists.txt
index 42161988b..92354559e 100644
--- a/Plugin/CMakeLists.txt
+++ b/Plugin/CMakeLists.txt
@@ -111,7 +111,7 @@ if(NOT MINGW)
 else()
   install(
     TARGETS plugin
-    RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
-    LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}
+    RUNTIME DESTINATION ${CL_INSTALL_BIN}
+    LIBRARY DESTINATION ${CL_INSTALL_BIN}
     ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
 endif()
diff --git a/sdk/wxsqlite3/CMakeLists.txt b/sdk/wxsqlite3/CMakeLists.txt
index 3c260431f..6cf701365 100644
--- a/sdk/wxsqlite3/CMakeLists.txt
+++ b/sdk/wxsqlite3/CMakeLists.txt
@@ -40,7 +40,7 @@ if(NOT MINGW)
 else()
     install(
         TARGETS wxsqlite3
-        RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
-        LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}
+        RUNTIME DESTINATION ${CL_INSTALL_BIN}
+        LIBRARY DESTINATION ${CL_INSTALL_BIN}
         ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
 endif()
diff --git a/wxcrafter/src/wxgui_bitmaploader.cpp b/wxcrafter/src/wxgui_bitmaploader.cpp
index 17c70d930..9687f49af 100644
--- a/wxcrafter/src/wxgui_bitmaploader.cpp
+++ b/wxcrafter/src/wxgui_bitmaploader.cpp
@@ -14,7 +14,12 @@ wxCrafter::ResourceLoader::ResourceLoader(const wxString& skin)
 {
     if(m_bitmaps.empty()) {
         wxString zipFile;
+#ifdef USE_POSIX_LAYOUT
+        zipFile << wxStandardPaths::Get().GetDataDir() << wxT(INSTALL_DIR) << wxFileName::GetPathSeparator() << skin
+                << wxT(".zip");
+#else
         zipFile << wxStandardPaths::Get().GetDataDir() << wxFileName::GetPathSeparator() << skin << wxT(".zip");
+#endif
         clZipReader zip(zipFile);
 
         std::unordered_map<wxString, clZipReader::Entry> entries;
-- 
2.48.1.windows.1

