add extra logging and error handling on initial load
This commit is contained in:
@@ -49,7 +49,7 @@ bool World::IsEditableWorld(BlizzardDatabaseLib::Structures::BlizzardDatabaseRow
|
||||
|
||||
if (!Noggit::Application::NoggitApplication::instance()->clientData()->exists(ssfilename.str()))
|
||||
{
|
||||
Log << "World " << record.RecordId << ": " << lMapName << " has no WDT file!" << std::endl;
|
||||
LogDebug << "World " << record.RecordId << ": " << lMapName << " has no WDT file!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include <noggit/project/ApplicationProject.h>
|
||||
#include <noggit/Log.h>
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
namespace Noggit::Application
|
||||
{
|
||||
void NoggitApplication::initalize(int argc, char* argv[], std::vector<bool> Parser)
|
||||
@@ -9,8 +11,13 @@ namespace Noggit::Application
|
||||
InitLogging();
|
||||
Command = Parser;
|
||||
|
||||
QLocale locale = QLocale(QLocale::English);
|
||||
QString dateTimeText = locale.toString(QDateTime::currentDateTime(), "dd MMMM yyyy hh:mm:ss");
|
||||
Log << "Start time : " << dateTimeText.toStdString() << std::endl;
|
||||
|
||||
//Locate application relative path
|
||||
Log << "Noggit Studio - " << STRPRODUCTVER << std::endl;
|
||||
Log << "Build Date : " << __DATE__ ", " __TIME__ << std::endl;
|
||||
|
||||
auto applicationLocation = std::filesystem::path(argv[0]);
|
||||
Log << "Noggit Application Path: " << applicationLocation << std::endl;
|
||||
@@ -133,6 +140,8 @@ namespace Noggit::Application
|
||||
);
|
||||
}
|
||||
LogError << "std::terminate: " << reason << std::endl;
|
||||
|
||||
CloseLogging();
|
||||
}
|
||||
|
||||
bool NoggitApplication::GetCommand(int index)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <blizzard-database-library/include/BlizzardDatabase.h>
|
||||
#include <noggit/application/Configuration/NoggitApplicationConfiguration.hpp>
|
||||
#include <noggit/ui/windows/downloadFileDialog/DownloadFileDialog.h>
|
||||
#include <noggit/Log.h>
|
||||
#include <QJsonDocument>
|
||||
#include <QMessageBox>
|
||||
#include <QJsonObject>
|
||||
@@ -251,8 +252,12 @@ namespace Noggit::Project
|
||||
ApplicationProjectReader project_reader{};
|
||||
auto project = project_reader.readProject(project_path);
|
||||
|
||||
if(!project.has_value())
|
||||
if (!project.has_value())
|
||||
{
|
||||
LogError << "loadProject() failed, Project is null" << std::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
project_reader.readPalettes(&project.value());
|
||||
project_reader.readObjectSelectionGroups(&project.value());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <noggit/project/ApplicationProjectReader.h>
|
||||
#include <noggit/project/ApplicationProject.h>
|
||||
#include <noggit/Log.h>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QFile>
|
||||
@@ -15,7 +16,10 @@ namespace Noggit::Project
|
||||
{
|
||||
|
||||
if (!std::filesystem::exists(project_path) || !std::filesystem::is_directory(project_path))
|
||||
{
|
||||
LogError << "Failed to read project path : " << project_path << std::endl;
|
||||
return {};
|
||||
}
|
||||
|
||||
for (const auto& entry: std::filesystem::directory_iterator(project_path))
|
||||
{
|
||||
@@ -102,6 +106,7 @@ namespace Noggit::Project
|
||||
}
|
||||
} else
|
||||
{
|
||||
LogError << "Project file is corrupted : " << project_path << std::endl;
|
||||
input_file.close();
|
||||
return {};
|
||||
}
|
||||
@@ -110,6 +115,7 @@ namespace Noggit::Project
|
||||
}
|
||||
}
|
||||
|
||||
LogError << "Failed to find a .noggitproj file in project path : " << project_path << std::endl;
|
||||
return {};
|
||||
}
|
||||
void ApplicationProjectReader::readPalettes(NoggitProject* project)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <noggit/ui/FontAwesome.hpp>
|
||||
#include <noggit/ui/FramelessWindow.hpp>
|
||||
#include <noggit/ui/tools/UiCommon/StackedWidget.hpp>
|
||||
#include <noggit/project/ApplicationProject.h>
|
||||
#include <BlizzardDatabase.h>
|
||||
#include <QtGui/QCloseEvent>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
@@ -64,6 +65,8 @@ namespace Noggit::Ui::Windows
|
||||
setWindowTitle(QString::fromStdString(title.str()));
|
||||
setWindowIcon(QIcon(":/icon"));
|
||||
|
||||
Log << "Project version : " << Noggit::Project::ClientVersionFactory::MapToStringVersion(project->projectVersion).c_str() << std::endl;
|
||||
|
||||
if (project->projectVersion == Project::ProjectVersion::WOTLK)
|
||||
{
|
||||
OpenDBs(project->ClientData);
|
||||
|
||||
@@ -78,7 +78,7 @@ NoggitProjectCreationDialog::NoggitProjectCreationDialog(ProjectInformation& pro
|
||||
std::filesystem::path game_path(project_information.game_client_path);
|
||||
if (!std::filesystem::exists(game_path))
|
||||
{
|
||||
QMessageBox::critical(this, "Error", "Game client path does not exist.");
|
||||
QMessageBox::critical(this, "Error", "Game client path does not exist. \nAvoid special characters.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,6 +92,12 @@ NoggitProjectCreationDialog::NoggitProjectCreationDialog(ProjectInformation& pro
|
||||
return;
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(project_path))
|
||||
{
|
||||
QMessageBox::critical(this, "Error", "Project path does not exist. \nAvoid special characters.");
|
||||
return;
|
||||
}
|
||||
|
||||
project_information.game_client_version = ui->project_expansion->currentText().toStdString();
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <noggit/ui/windows/projectSelection/components/CreateProjectComponent.hpp>
|
||||
#include <noggit/ui/windows/projectSelection/components/LoadProjectComponent.hpp>
|
||||
#include <noggit/project/CurrentProject.hpp>
|
||||
#include <noggit/Log.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <QString>
|
||||
@@ -87,7 +88,11 @@ NoggitProjectSelectionWindow::NoggitProjectSelectionWindow(Noggit::Application::
|
||||
"*.noggitproj");
|
||||
|
||||
if (proj_file.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(this, "Error", "Failed to read project: project file is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::filesystem::path filepath(proj_file.toStdString());
|
||||
|
||||
@@ -130,7 +135,10 @@ NoggitProjectSelectionWindow::NoggitProjectSelectionWindow(Noggit::Application::
|
||||
auto selected_project = _load_project_component->loadProject(this);
|
||||
|
||||
if (!selected_project)
|
||||
{
|
||||
LogError << "Selected Project is null, loading failed." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Noggit::Project::CurrentProject::initialize(selected_project.get());
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <noggit/project/ApplicationProject.h>
|
||||
#include <noggit/ui/windows/projectSelection/NoggitProjectSelectionWindow.hpp>
|
||||
#include <noggit/Log.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
@@ -29,7 +30,11 @@ namespace Noggit::Ui::Component
|
||||
auto application_project_service = Noggit::Project::ApplicationProject(application_configuration);
|
||||
|
||||
if (!QDir(project_path).exists())
|
||||
{
|
||||
LogError << "Project path does not exist : " << project_path.toStdString() << std::endl;
|
||||
return {};
|
||||
}
|
||||
Log << "Loading Project path : " << project_path.toStdString() << std::endl;
|
||||
|
||||
// check if current filesystem is case sensitive
|
||||
QDir q_project_path{project_path};
|
||||
@@ -46,6 +51,7 @@ namespace Noggit::Ui::Component
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError << "Failed to open file : " << file_1_path.toStdString() << std::endl;
|
||||
assert(false);
|
||||
return {};
|
||||
}
|
||||
@@ -59,6 +65,7 @@ namespace Noggit::Ui::Component
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError << "Failed to open file : " << file_2_path.toStdString() << std::endl;
|
||||
assert(false);
|
||||
return {};
|
||||
}
|
||||
@@ -77,6 +84,7 @@ namespace Noggit::Ui::Component
|
||||
}
|
||||
else
|
||||
{
|
||||
LogError << "Failed to read file content : " << file_1_path.toStdString() << std::endl;
|
||||
assert(false);
|
||||
return {};
|
||||
}
|
||||
@@ -160,6 +168,8 @@ namespace Noggit::Ui::Component
|
||||
//This to not be static, but its hard to remove
|
||||
if (project)
|
||||
Noggit::Application::NoggitApplication::instance()->setClientData(project->ClientData);
|
||||
else
|
||||
LogError << "Couldn't set client data : Project loading failed." << std::endl;
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user