Skip to content

Commit 3cef425

Browse files
committed
fix: EPMCLI example missing QCoreApplication caused unreliable path resolution
EPMCLI.exe's main() never constructed a QCoreApplication/QApplication object, yet its call chain (InitializeEPMDev -> EPMPreferences::setAppName -> defaultPlatformPath -> epmConfigRoot -> applicationDataPath -> installFolderName -> QCoreApplication::applicationDirPath()) depends on one existing. Without it, applicationDirPath() emits a runtime warning and returns an unreliable result, causing installFolderName() to fall back to a default value instead of correctly deriving the actual install folder name. This meant EPMCLI could look in the wrong ProgramData namespace for configs depending on how the package was installed. Fixed by constructing a minimal QCoreApplication at the start of main(), matching the pattern already used correctly by all real GUI apps.
1 parent d8905fc commit 3cef425

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

examples/C++/epm-cli/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ wchar_t gDeviceName[1024];
1212
#include "Range.h"
1313

1414
// Qt
15+
#include <QCoreApplication>
1516
#include <QList>
1617
#include <QString>
1718
#include <QStringList>
@@ -31,8 +32,7 @@ typedef QList<EPMDeviceDesc> EPMDeviceDescriptors;
3132

3233
int main(int argc, char* argv[])
3334
{
34-
(void) argc;
35-
(void) argv;
35+
QCoreApplication a(argc, argv);
3636

3737
char temp[1024];
3838

0 commit comments

Comments
 (0)