MCPcopy Create free account
hub / github.com/TheAssassin/AppImageLauncher / getConfig

Function getConfig

src/shared/shared.cpp:181–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179
180
181std::shared_ptr<QSettings> getConfig() {
182 auto configFilePath = getConfigFilePath();
183
184 // if the file does not exist, we'll just use the standard location
185 // while in theory it would have been possible to just write the default location to the file, if we'd ever change
186 // it again, we'd leave a lot of systems in the old state, and would have to write some complex code to resolve
187 // the situation
188 // therefore, the file is simply created, but left empty intentionally
189 if (!QFileInfo::exists(configFilePath)) {
190 return nullptr;
191 }
192
193 auto rv = std::make_shared<QSettings>(configFilePath, QSettings::IniFormat);
194
195 // expand ~ in paths in the config file with $HOME
196 const auto keysContainingPath = {
197 "AppImageLauncher/destination",
198 };
199 for (const QString& keyContainingPath : keysContainingPath){
200 if (rv->contains(keyContainingPath)) {
201 auto newValue = expandTilde(rv->value(keyContainingPath).toString());
202 rv->setValue(keyContainingPath, newValue);
203 }
204 }
205
206 return rv;
207}
208
209// TODO: check if this works with Wayland
210bool isHeadless() {

Callers 5

loadSettingsMethod · 0.85
saveSettingsMethod · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 2

getConfigFilePathFunction · 0.85
expandTildeFunction · 0.85

Tested by

no test coverage detected