Fix toml errors hopefully

This commit is contained in:
offtkp 2024-09-25 15:46:21 +03:00
parent 4fd41bfb39
commit 87b8342b08
5 changed files with 11 additions and 11 deletions

View file

@ -35,7 +35,7 @@ static bool vkMarkers = false;
static bool vkCrashDiagnostic = false;
// Gui
std::filesystem::path settings_install_dir = "";
std::filesystem::path settings_install_dir = {};
u32 main_window_geometry_x = 400;
u32 main_window_geometry_y = 400;
u32 main_window_geometry_w = 1280;
@ -241,7 +241,7 @@ void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h) {
main_window_geometry_w = w;
main_window_geometry_h = h;
}
void setGameInstallDir(const std::string& dir) {
void setGameInstallDir(const std::filesystem::path& dir) {
settings_install_dir = dir;
}
void setMainWindowTheme(u32 theme) {
@ -297,7 +297,7 @@ u32 getMainWindowGeometryW() {
u32 getMainWindowGeometryH() {
return main_window_geometry_h;
}
std::string getGameInstallDir() {
std::filesystem::path getGameInstallDir() {
return settings_install_dir;
}
u32 getMainWindowTheme() {
@ -415,8 +415,7 @@ void load(const std::filesystem::path& path) {
mw_themes = toml::find_or<int>(gui, "theme", 0);
m_window_size_W = toml::find_or<int>(gui, "mw_width", 0);
m_window_size_H = toml::find_or<int>(gui, "mw_height", 0);
settings_install_dir =
toml::find_or<std::filesystem::path::string_type>(gui, "installDir", {});
settings_install_dir = toml::find_or<std::u8string>(gui, "installDir", {});
main_window_geometry_x = toml::find_or<int>(gui, "geometry_x", 0);
main_window_geometry_y = toml::find_or<int>(gui, "geometry_y", 0);
main_window_geometry_w = toml::find_or<int>(gui, "geometry_w", 0);

View file

@ -66,7 +66,7 @@ bool vkCrashDiagnosticEnabled();
// Gui
void setMainWindowGeometry(u32 x, u32 y, u32 w, u32 h);
void setGameInstallDir(const std::string& dir);
void setGameInstallDir(const std::filesystem::path& dir);
void setMainWindowTheme(u32 theme);
void setIconSize(u32 size);
void setIconSizeGrid(u32 size);
@ -84,7 +84,7 @@ u32 getMainWindowGeometryX();
u32 getMainWindowGeometryY();
u32 getMainWindowGeometryW();
u32 getMainWindowGeometryH();
std::string getGameInstallDir();
std::filesystem::path getGameInstallDir();
u32 getMainWindowTheme();
u32 getIconSize();
u32 getIconSizeGrid();

View file

@ -78,7 +78,7 @@ void GameInstallDialog::Save() {
return;
}
Config::setGameInstallDir(gamesDirectory.toStdString());
Config::setGameInstallDir(Common::FS::PathFromQString(gamesDirectory));
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
Config::save(config_dir / "config.toml");
accept();

View file

@ -22,7 +22,7 @@ int main(int argc, char* argv[]) {
bool has_command_line_argument = argc > 1;
// Check if the game install directory is set
if (Config::getGameInstallDir() == "" && !has_command_line_argument) {
if (Config::getGameInstallDir().empty() && !has_command_line_argument) {
GameInstallDialog dlg;
dlg.exec();
}

View file

@ -631,7 +631,7 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
pkg = PKG();
pkg.Open(file);
std::string failreason;
auto extract_path = std::filesystem::path(Config::getGameInstallDir()) / pkg.GetTitleID();
auto extract_path = Config::getGameInstallDir() / pkg.GetTitleID();
QString pkgType = QString::fromStdString(pkg.GetPkgFlags());
QString gameDirPath;
Common::FS::PathToQString(gameDirPath, extract_path);
@ -779,7 +779,8 @@ void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int
QFutureWatcher<void> futureWatcher;
connect(&futureWatcher, &QFutureWatcher<void>::finished, this, [=, this]() {
if (pkgNum == nPkg) {
QString path = QString::fromStdString(Config::getGameInstallDir());
QString path;
Common::FS::PathToQString(path, Config::getGameInstallDir());
QMessageBox extractMsgBox(this);
extractMsgBox.setWindowTitle(tr("Extraction Finished"));
extractMsgBox.setText(