MCPcopy Create free account
hub / github.com/aldelaro5/dolphin-memory-engine / SConfig

Method SConfig

Source/GUI/Settings/SConfig.cpp:16–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16SConfig::SConfig()
17{
18 assert(!g_instance && "Only a single SConfig instance is allowed");
19 g_instance = this;
20
21 const QString exeDir = QCoreApplication::applicationDirPath();
22 const QString portableFilePath = exeDir + "/portable.txt";
23 QFile file(portableFilePath);
24 if (file.exists())
25 {
26 m_settings = new QSettings(exeDir + "/settings.ini", QSettings::IniFormat);
27 }
28 else
29 {
30 const QString organization{"dolphin-memory-engine"};
31 const QString application{"dolphin-memory-engine"};
32 m_settings =
33 new QSettings(QSettings::IniFormat, QSettings::UserScope, organization, application);
34 }
35
36 const QString lockFilepath{m_settings->fileName() + "_lock"};
37 QDir().mkpath(QFileInfo{lockFilepath}.absolutePath());
38 m_lockFile = std::make_unique<QLockFile>(lockFilepath);
39 if (!m_lockFile->tryLock())
40 {
41 std::cerr << "ERROR: Unable to lock \"" + lockFilepath.toStdString() +
42 "\". Is another instance running?\n";
43 }
44}
45
46SConfig::~SConfig()
47{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected