4 ms·
The right solution, actually, is to use a library that gives you the right path for the thing that you need to do depending on the conventions of the platform.
by majewsky 10y ago
The right solution, actually, is to use a library that gives you the right path for the thing that you need to do depending on the conventions of the platform. For example QStandardPaths in Qt: http://doc.qt.io/qt-5/qstandardpaths.html http://doc.qt.io/qt-5/qstandardpaths.html
QString appDataDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
// ~/Library/Application Support/<APPNAME> on macOS
// C:/Users/<USER>/AppData/Roaming/<APPNAME> on Windows
// ~/.local/share/<APPNAME> on Linux
- teh_klev 10y agoStill doesn't solve the case where the developer just wants to slap something in the root of the C: drive on windows from the outset (Cygwin I seem to remember defaults to c:\Cygwin for example...again slightly convoluted). Also those locations are user specific, there's nothing there to support the use-case of an app that's available to all users, or might just be a system service (/daemon).