NOISSUE maybe fill in correct FTB App settings paths

This commit is contained in:
Petr Mrázek 2022-05-28 23:23:45 +02:00
parent 41e5b3b628
commit efe181bd28
2 changed files with 20 additions and 2 deletions

View File

@ -38,7 +38,7 @@ public:
virtual ~FTBAPage();
QString displayName() const override
{
return tr("FTBApp Import");
return tr("FTB App Import");
}
QIcon icon() const override
{

View File

@ -64,11 +64,29 @@ QVariant Model::data(const QModelIndex &index, int role) const
}
namespace {
#if defined (Q_OS_OSX)
QString getFTBASettingsPath() {
return FS::PathCombine(QDir::homePath(), "Library/Application Support/.ftba/bin/settings.json");
}
#elif defined(Q_OS_WIN32)
QString getFTBASettingsPath() {
auto appDataLocalInner = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation);
QDir appdata(appDataLocalInner);
appdata.cdUp();
return FS::PathCombine(appdata.absolutePath(), ".ftba/bin/settings.json");
}
#else
QString getFTBASettingsPath() {
return FS::PathCombine(QDir::homePath(), ".ftba/bin/settings.json");
}
#endif
QString getFTBAInstances() {
QByteArray data;
try
{
auto path = FS::PathCombine(QDir::homePath(), ".ftba/bin/settings.json");
auto path = getFTBASettingsPath();
data = FS::read(path);
}
catch (const Exception &e)