You could place your xml files in "/etc/<app>/" or you create your own application directories (etc, lib, ...) and place it into the "/opt/<app>" directory.
<app> could be "QApplication::applicationName()", so if you have the following folder structure:
/opt
/opt/demo
/opt/demo/bin
/opt/demo/etc
/opt/demo/log
/opt
/opt/demo
/opt/demo/bin
/opt/demo/etc
/opt/demo/log
To copy to clipboard, switch view to plain text mode
You could than write:
// Get the application config (/opt/demo/etc/demo.xml)
QString configFilename
= QString("%0%1..%1etc%1demo.xml").
arg(qApp
->applicationDirPath
()).
arg(QDir::separator());
QString logFilename
= QString("%0%1..%1log%1demo.log").
arg(qApp
->applicationDirPath
()).
arg(QDir::separator());
QFile configFile
(configFilename
);
QFile logFile
(logFilename
);
.
.
// Get the application config (/opt/demo/etc/demo.xml)
QString configFilename = QString("%0%1..%1etc%1demo.xml").arg(qApp->applicationDirPath()).arg(QDir::separator());
QString logFilename = QString("%0%1..%1log%1demo.log").arg(qApp->applicationDirPath()).arg(QDir::separator());
QFile configFile(configFilename);
QFile logFile(logFilename);
.
.
To copy to clipboard, switch view to plain text mode
Regards NoRulez
Bookmarks