Skip to content

Commit

Permalink
Gui
Browse files Browse the repository at this point in the history
- Windows: forcing portable mode if the registry isn't writable (non-
  • Loading branch information
Jmgr committed Mar 13, 2012
1 parent 9c0d52a commit 67f293e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,20 @@ int main(int argc, char **argv)
options.alias("help", "h");
options.parse(QCoreApplication::arguments());

if(options.count("portable"))
bool isPortable = (options.count("portable") > 0);

#ifdef Q_WS_WIN
if(!isPortable)
{
// Try to access the registry
QSettings settings;

if(!settings.isWritable())
isPortable = true;
}
#endif

if(isPortable)
{
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, QApplication::applicationDirPath() + "/userSettings");
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, QApplication::applicationDirPath() + "/systemSettings");
Expand Down

0 comments on commit 67f293e

Please sign in to comment.