| 179 | |
| 180 | |
| 181 | std::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 |
| 210 | bool isHeadless() { |
no test coverage detected