diff --git a/src/nostalgia/studio/lib/json_read.hpp b/src/nostalgia/studio/lib/json_read.hpp index b25a9d42..c5215810 100644 --- a/src/nostalgia/studio/lib/json_read.hpp +++ b/src/nostalgia/studio/lib/json_read.hpp @@ -91,7 +91,12 @@ ox::Error JsonReader::field(QJsonValueRef src, T *dest) { template ox::Error readJson(QString json, T *dest) { - auto obj = QJsonDocument::fromJson(json.toUtf8()).object(); + QJsonParseError err; + auto obj = QJsonDocument::fromJson(json.toUtf8(), &err).object(); + qDebug() << "JSON parsing error:" << err.errorString(); + if (err.error) { + return OxError(1); + } JsonReader rdr(obj); return model(&rdr, dest); } diff --git a/src/nostalgia/studio/main.cpp b/src/nostalgia/studio/main.cpp index 6765d61f..685309e6 100644 --- a/src/nostalgia/studio/main.cpp +++ b/src/nostalgia/studio/main.cpp @@ -7,6 +7,7 @@ */ #include +#include #include #include "mainwindow.hpp" @@ -16,15 +17,19 @@ int main(int argc, char **args) { ox::ClArgs clargs(argc, const_cast(args)); QString argProfilePath = clargs.getString("profile").c_str(); - NostalgiaStudioProfile config; - + for (int i = 0; i < argc; i++) { + qDebug() << args[i]; + } QApplication app(argc, args); app.setAttribute(Qt::AA_UseHighDpiPixmaps); - MainWindow w(argProfilePath); - app.setApplicationName(w.windowTitle()); - w.show(); - QObject::connect(&app, &QApplication::aboutToQuit, &w, &MainWindow::onExit); - - return app.exec(); + try { + MainWindow w(argProfilePath); + app.setApplicationName(w.windowTitle()); + w.show(); + QObject::connect(&app, &QApplication::aboutToQuit, &w, &MainWindow::onExit); + return app.exec(); + } catch (ox::Error err) { + oxPanic(err, "Unhandled ox::Error"); + } } diff --git a/src/nostalgia/studio/mainwindow.cpp b/src/nostalgia/studio/mainwindow.cpp index 8694e7d9..6b041f39 100644 --- a/src/nostalgia/studio/mainwindow.cpp +++ b/src/nostalgia/studio/mainwindow.cpp @@ -40,7 +40,8 @@ MainWindow::MainWindow(QString profilePath) { if (file.exists()) { file.open(QIODevice::ReadOnly); QTextStream in(&file); - readJson(in.readAll(), &m_profile); + oxThrowError(readJson(in.readAll(), &m_profile)); + qDebug() << m_profile.appName; } auto screenSize = QApplication::screens().first()->geometry(); diff --git a/src/nostalgia/studio/nostalgia-studio-dev.json b/src/nostalgia/studio/nostalgia-studio-dev.json index 96e2e1c2..c0a67ea6 100644 --- a/src/nostalgia/studio/nostalgia-studio-dev.json +++ b/src/nostalgia/studio/nostalgia-studio-dev.json @@ -1,10 +1,10 @@ { "app_name": "Nostalgia Studio", "org_name": "Drinking Tea", - "plugins": [ - { - "dir": "./", - "lib_name": "NostalgiaCore-Studio" - } + "plugins_path": [ + "../lib/nostalgia/plugins", + "../Plugins", + "../../../out/build/x64-Debug", + "../../../out/build/x64-Release" ] }