#include <QApplication>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QStandardPaths>
#include <QTemporaryFile>
#include <cstdlib>
|
| constexpr bool | isPortableMode () |
| | Determines if the application should run in portable mode.
|
| bool | isDirWritable (const QString &path) |
| | Checks writability by creating a file.
|
| QString | getConfigDir () |
| | Returns the directory for configuration files (settings.ini).
|
| QString | getDataDir () |
| | Returns the directory for application data files (profiles, etc.).
|
◆ getConfigDir()
Returns the directory for configuration files (settings.ini).
- Portable mode: Parent directory of the executable's directory
- Installable mode:
- Linux: ~/.config/VirtualGamePad/
- Windows: LOCALAPPDATA%/<org>/<app>/ (Qt AppConfigLocation)
- Debug builds: Always use application directory
- Warning
- Instantiate the QApplication object first
◆ getDataDir()
Returns the directory for application data files (profiles, etc.).
- Portable mode: Same as config directory
- Installable mode:
- Linux: ~/.local/share/VirtualGamePad/
- Windows: LOCALAPPDATA%/<org>/<app>/ (Qt AppConfigLocation, same as config)
- Debug builds: Always use application directory
- Warning
- Instantiate the QApplication object first
◆ isDirWritable()
| bool isDirWritable |
( |
const QString & | path | ) |
|
|
inline |
Checks writability by creating a file.
QFileInfo::isWritable() ignores NTFS ACLs unless a global flag is set, so it cannot be trusted.
◆ isPortableMode()
Determines if the application should run in portable mode.
Portable mode is determined by the build-time flag PORTABLE_BUILD.
In portable mode, settings and data are stored in the application directory (the parent of the directory containing the executable). In installable mode, standard OS locations are used (~/.config, LOCALAPPDATA%, etc.).