Mantis Bug Tracker

View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000746EMStudioGeneralpublic2012-10-16 15:452012-11-06 18:48
ReporterFred 
Assigned ToFred 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformAllOSAllOS VersionAll
Product Version0.0.1-SNAPSHOT 
Target Version0.0.1Fixed in Version0.0.1-SNAPSHOT 
Summary0000746: Better file handling for configuration
DescriptionSee parent 0000744
TagsNo tags attached.
Issue TypeImprovement
Attached Files

- Relationships
child of 0000744assignedmalcom2073 Better file handling 

-  Notes
User avatar (0002348)
Fred (administrator)
2012-10-16 15:47

This entails getting the correct directories on all OS variants. Sean may have some insight for you as he worked on this a bit.
User avatar (0002349)
Fred (administrator)
2012-10-16 15:48
edited on: 2012-10-16 15:49

It also means having a config dir ~/.EMStudio/ on *nix (and mac for now, but different later), and ? on Win, Ben and Hentai can confirm this ? value. And a config file inside it, same format for all three, that then points to other dirs. This is likely partly done already.

User avatar (0002352)
sean94z (reporter)
2012-10-16 15:56
edited on: 2012-10-16 15:59

This is the QSettings code that I came up with based on forum discussion:

    /* restore settings */
// QSettings settings("FreeEMS", "Loader");
#ifdef __WIN32__
        QString appDataDir = getenv("AppData");
        m_autoRipDirectory = appDataDir;
        m_autoRipDirectory += "\\FreeEMS-Loader\\";
        appDataDir = m_autoRipDirectory;
        if (!QDir(appDataDir).exists(appDataDir))
            QDir(appDataDir).mkpath(appDataDir);
        appDataDir += "settings\\";
        if (!QDir(appDataDir).exists(appDataDir))
            QDir(appDataDir).mkpath(appDataDir);
        m_autoRipDirectory += "rips\\";
        if (!QDir(m_autoRipDirectory).exists(m_autoRipDirectory))
            QDir(m_autoRipDirectory).mkpath(m_autoRipDirectory);
#else
        appDataDir = getenv("HOME");
        m_autoRipDirectory = appDataDir;
        appDataDir += "/.FreeEMS-Loader/";
        m_autoRipDirectory += "/FreeEMS-Loader/";
        if (!QDir(appDataDir).exists(appDataDir))
            QDir(appDataDir).mkpath(appDataDir);
        appDataDir += "settings/";
        if (!QDir(appDataDir).exists(appDataDir))
            QDir(appDataDir).mkpath(appDataDir);
        if (!QDir(m_autoRipDirectory).exists(m_autoRipDirectory))
            QDir(m_autoRipDirectory).mkpath(m_autoRipDirectory);
        m_autoRipDirectory += "rips/";
        if (!QDir(m_autoRipDirectory).exists(m_autoRipDirectory))
            QDir(m_autoRipDirectory).mkpath(m_autoRipDirectory);
#endif
    settingsFile = appDataDir + "settings.ini";
    qDebug() << "settings file is -> " << settingsFile;
    QSettings loaderSettings(settingsFile, QSettings::IniFormat);

    /* initialize file and dir locations */
    if (loaderSettings.value("autoRipDirectory").isNull()) {
        displayMessage(MESSAGE_INFO, "This appears to be the first time FreeEMS Loader has been "
                "run on this host, initializing settings..");
I'll keep a close eye on this :)

User avatar (0002355)
BenFenner (updater)
2012-10-16 16:19

Windows should be:

%appdata%\EMStudio\EMStudio-config.json
User avatar (0002356)
BenFenner (updater)
2012-10-16 16:19

Fred says Mac and Linux should be:

~/.EMStudio/EMStudio-config.json
User avatar (0002357)
Fred (administrator)
2012-10-16 16:31

Mac only temporarily, so for now it should go:

if (win) {} else {/*the rest*/}
User avatar (0002380)
malcom2073 (manager)
2012-11-06 18:48

Done in bf8560eb3211d7b32f5a7581860a30267c28067d


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker