Skip to content

Commit

Permalink
Fix | absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
Golevka2001 committed Oct 31, 2022
1 parent 005e318 commit c85b4ea
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 49 deletions.
4 changes: 2 additions & 2 deletions Includes/config.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/******************************************************************************
* @File: config.h
* @Author: Gol3vka<[email protected]>
* @Version: 2.0.1
* @Version: 2.1.0
* @Created date: 2022/10/21
* @Last modified date: 2022/10/29
* @Last modified date: 2022/10/31
*****************************************************************************/

#pragma once
Expand Down
4 changes: 2 additions & 2 deletions Includes/config_loader.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/******************************************************************************
* @File: config_loader.h
* @Author: Gol3vka<[email protected]>
* @Version: 2.0.1
* @Version: 2.1.0
* @Created date: 2022/10/21
* @Last modified date: 2022/10/29
* @Last modified date: 2022/10/31
*****************************************************************************/

#pragma once
Expand Down
4 changes: 2 additions & 2 deletions Includes/selection_dialog.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/******************************************************************************
* @File: selection_dialog.h
* @Author: Gol3vka<[email protected]>
* @Version: 2.0.1
* @Version: 2.1.0
* @Created date: 2022/10/21
* @Last modified date: 2022/10/29
* @Last modified date: 2022/10/31
*****************************************************************************/

#pragma once
Expand Down
5 changes: 2 additions & 3 deletions Sources/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
* @File: config.cpp
* @Brief: Config class.
* @Author: Gol3vka<[email protected]>
* @Version: 2.0.1
* @Version: 2.1.0
* @Created date: 2022/10/21
* @Last modified date: 2022/10/29
* @Last modified date: 2022/10/31
*****************************************************************************/

#include "../Includes/config.h"

#include <QByteArray>
#include <QDebug> /////////////////
#include <QIODevice>
#include <QMessageBox>
#include <QRegularExpression>
Expand Down
40 changes: 7 additions & 33 deletions Sources/config_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @File: config_loader.cpp
* @Brief: Main window of the tool.
* @Author: Gol3vka<[email protected]>
* @Version: 2.0.1
* @Version: 2.1.0
* @Created date: 2022/10/21
* @Last modified date: 2022/10/29
* @Last modified date: 2022/10/31
*****************************************************************************/

#include "../Includes/config_loader.h"
Expand All @@ -20,9 +20,11 @@ ConfigLoader::ConfigLoader(QWidget *parent) : QMainWindow(parent)
{
ui.setupUi(this);

/* set path of folders */
assets_folder_path_ = "C:/Program Files/Engine Sim/assets/";
// assets_folder_path_ = "../assets/";
/* set absolute path of folders */
// assets_folder_path_ = "C:/Program Files/Engine Sim/assets/";
QDir temp_dir("../assets/");
assets_folder_path_ = temp_dir.absolutePath() + '/';
config_.SetRootPath(assets_folder_path_);
engines_folder_path_ = assets_folder_path_ + "engines/";
themes_folder_path_ = assets_folder_path_ + "themes/";

Expand All @@ -48,8 +50,6 @@ ConfigLoader::ConfigLoader(QWidget *parent) : QMainWindow(parent)
exit(EXIT_FAILURE);
}

config_.SetRootPath(assets_folder_path_);

/* read "main.mr" as default config */
config_.Read();

Expand All @@ -75,32 +75,6 @@ ConfigLoader::ConfigLoader(QWidget *parent) : QMainWindow(parent)

ConfigLoader::~ConfigLoader() { delete file_model_; }

/* read "main.mr" file
void ConfigLoader::ReadMainFile()
{
QByteArray line;
line.clear();
QString theme_file_name_;
QRegularExpression theme_include("^import[ |\s]*\"themes/");
if (!main_file_.open(QIODevice::ReadOnly | QIODevice::Text))
QMessageBox::critical(NULL, "ERROR", "File \"main.mr\" is not accessible.",
QMessageBox::Ok);
else
{
while (!main_file_.atEnd())
{
line = main_file_.readLine();
if (theme_include.match(line).hasMatch())
{
theme_file_path_ = assets_folder_path_ + line.split('\"')[1];
QFile theme_file(theme_file_path_);
}
}
main_file_.close();
}
}
*/

/* display engine files in tree view */
void ConfigLoader::DisplayTreeView()
{
Expand Down
8 changes: 3 additions & 5 deletions Sources/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
* then "main.mr" will be automatically generated.
* @File: main.cpp
* @Author: Gol3vka<[email protected]>
* @Version: 2.0.1
* @Version: 2.1.0
* @What's new:
* 1) Modifying theme is available.\
* 2) Add a dialog for engine files where the program can not decide\
* which is the engine node.
* 1) Read old config file as default config.
* @Created date: 2022/10/21
* @Last modified date: 2022/10/29
* @Last modified date: 2022/10/31
*****************************************************************************/

#include <QtWidgets/QApplication>
Expand Down
4 changes: 2 additions & 2 deletions Sources/selection_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @File: selection_dialog.cpp
* @Brife: A dialog for users to select engine, transmission and vehicle nodes.
* @Author: Gol3vka<[email protected]>
* @Version: 2.0.1
* @Version: 2.1.0
* @Created date: 2022/10/21
* @Last modified date: 2022/10/29
* @Last modified date: 2022/10/31
*****************************************************************************/

#include "../Includes/selection_dialog.h"
Expand Down

0 comments on commit c85b4ea

Please sign in to comment.