Skip to content

Commit 45a3695

Browse files
committed
Update README and scripts for improved Qt platform plugin handling; add application icon for macOS
1 parent 7666ee1 commit 45a3695

4 files changed

Lines changed: 30 additions & 6 deletions

File tree

Resources/README-windows.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ If windows will show you a warning message "Windows protected your PC", click "M
1616

1717
Once GEM-Fits is running you can pin the program to the Task bar by right-clicking on its icon (on the task bar) and chose pin to task bar. After you close GEM-Fits, the script will create a Start Menu and Desktop shortcut. After the first run you can always start gems using its shortcut.
1818

19+
Always start GEM-Fits via `runshell.bat` or the Start Menu/Desktop shortcut it creates - do not
20+
double-click `gem-fits-shell.exe` directly inside `GemFits-app\bin`. If you do, and this machine
21+
already has another Qt installation (Anaconda, Qt Creator, etc.) that sets a
22+
`QT_QPA_PLATFORM_PLUGIN_PATH` or `QT_PLUGIN_PATH` environment variable, GEM-Fits can fail to start
23+
with `Could not find the Qt platform plugin "windows"` - `runshell.bat` and its shortcuts point
24+
these variables at the plugins bundled with this installation before launching, which the raw exe
25+
does not.
26+
1927
## Where are my projects?
2028

2129
Modeling projects (including the test projects bundled with this installation, which are copied there automatically on first start) live in `Library\GemFits\projects` in your user home folder (e.g. `C:\Users\<user>\Library\GemFits\projects`). Unlike on macOS, this `Library` folder is not hidden, so it can be opened directly in File Explorer or via the address bar.

Resources/runshell-windows.bat

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
rem Change the path to the actual location of gem-fits-shell executable and Resources
22
cd ./GemFits-app/bin
33

4+
rem Force Qt to use the platform plugin bundled with this app (GemFits-app\plugins\platforms).
5+
rem Without this, a QT_QPA_PLATFORM_PLUGIN_PATH or QT_PLUGIN_PATH already set on this machine
6+
rem (e.g. left over from an unrelated Anaconda/PyQt/Qt Creator install) silently overrides Qt's
7+
rem normal bundled-app lookup, and gem-fits-shell.exe aborts immediately with:
8+
rem qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
9+
set "QT_QPA_PLATFORM_PLUGIN_PATH=%CD%\..\plugins\platforms"
10+
set "QT_PLUGIN_PATH=%CD%\..\plugins"
11+
412
rem 1. First launch with default location of modeling projects (usually done by the installer)
513
rem gem-fits-shell.exe -d > gemsfits.log
614

@@ -22,14 +30,20 @@ rem 5. Create on desktop a shortcut
2230
@echo off
2331
setlocal
2432
set "scriptPath=%~dp0"
25-
set "targetPath=%scriptPath%GemFits-app\bin\gem-fits-shell.exe"
33+
rem Shortcuts target runshell.bat itself (not gem-fits-shell.exe directly) so that every
34+
rem launch - not just the very first one - goes through the QT_QPA_PLATFORM_PLUGIN_PATH fix
35+
rem above. Pointing a shortcut straight at the exe would skip that fix and could reproduce
36+
rem the "Could not find the Qt platform plugin" crash on machines with a conflicting Qt env var.
37+
set "targetPath=%scriptPath%runshell.bat"
38+
set "workingDir=%scriptPath%"
39+
set "exePath=%scriptPath%GemFits-app\bin\gem-fits-shell.exe"
2640
set "iconPath=%scriptPath%GemFits-app\Resources\gemsfits.ico"
2741
set "startMenuShortcut=%APPDATA%\Microsoft\Windows\Start Menu\Programs\gems-fits-shell.lnk"
2842
set "desktopShortcut=%USERPROFILE%\Desktop\gems-fits-shell.lnk"
2943

3044
REM Check if required files exist
31-
IF NOT EXIST "%targetPath%" (
32-
echo ERROR: Executable not found: "%targetPath%"
45+
IF NOT EXIST "%exePath%" (
46+
echo ERROR: Executable not found: "%exePath%"
3347
exit /b
3448
)
3549

@@ -43,6 +57,7 @@ echo Creating Start Menu shortcut...
4357
echo Set oWS = CreateObject("WScript.Shell") > CreateShortcut.vbs
4458
echo Set oLink = oWS.CreateShortcut("%startMenuShortcut%") >> CreateShortcut.vbs
4559
echo oLink.TargetPath = "%targetPath%" >> CreateShortcut.vbs
60+
echo oLink.WorkingDirectory = "%workingDir%" >> CreateShortcut.vbs
4661
echo oLink.IconLocation = "%iconPath%" >> CreateShortcut.vbs
4762
echo oLink.Save >> CreateShortcut.vbs
4863
cscript //nologo CreateShortcut.vbs
@@ -55,6 +70,7 @@ echo Set oWS = CreateObject("WScript.Shell") > CreateShortcut.vbs
5570
echo strDesktop = oWS.SpecialFolders("Desktop") >> CreateShortcut.vbs
5671
echo Set oLink = oWS.CreateShortcut(strDesktop ^& "\gems-fits-shell.lnk") >> CreateShortcut.vbs
5772
echo oLink.TargetPath = "%targetPath%" >> CreateShortcut.vbs
73+
echo oLink.WorkingDirectory = "%workingDir%" >> CreateShortcut.vbs
5874
echo oLink.IconLocation = "%iconPath%" >> CreateShortcut.vbs
5975
echo oLink.Save >> CreateShortcut.vbs
6076
cscript //nologo CreateShortcut.vbs

gfshell2/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ elseif (APPLE)
3434
# The MACOSX_BUNDLE_ICON_FILE variable is added to the Info.plist
3535
# generated by CMake. This variable contains the .icns file name,
3636
# without the path.
37-
set(MACOSX_BUNDLE_ICON_FILE gems3.icns)
37+
set(MACOSX_BUNDLE_ICON_FILE gemsfits.icns)
3838

3939
# And the following tells CMake where to find and install the file itself.
40-
set(app_icon_macos "${PROJECT_SOURCE_DIR}/Resources/gems3.icns")
40+
set(app_icon_macos "${PROJECT_SOURCE_DIR}/Resources/gemsfits.icns")
4141
set_source_files_properties(${app_icon_macos} PROPERTIES
4242
MACOSX_PACKAGE_LOCATION "Resources")
4343

@@ -46,7 +46,7 @@ elseif (APPLE)
4646
set_target_properties(gem-fits-shell PROPERTIES
4747
MACOSX_BUNDLE_GUI_IDENTIFIER ch.psi.gems-fits
4848
MACOSX_BUNDLE_COPYRIGHT "Copyright (c) 2004-2025 GEMS Development Team"
49-
MACOSX_BUNDLE_ICON_FILE gems3.icns
49+
MACOSX_BUNDLE_ICON_FILE gemsfits.icns
5050
MACOSX_BUNDLE_INFO_STRING "GEM Input Parameter Optimization and Inverse Modelling"
5151
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
5252
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}

0 commit comments

Comments
 (0)