Multiple Install Folders (#1308)

* multiple install folders implimentation

* clang format

* paths setting tab

* clang format
This commit is contained in:
ElBread3 2024-10-10 02:28:59 -05:00 committed by GitHub
parent c9f894c45a
commit 56e8ed7833
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 278 additions and 21 deletions

View file

@ -51,7 +51,9 @@ QWidget* GameInstallDialog::SetupGamesDirectory() {
// Input.
m_gamesDirectory = new QLineEdit();
QString install_dir;
Common::FS::PathToQString(install_dir, Config::getGameInstallDir());
std::filesystem::path install_path =
Config::getGameInstallDirs().empty() ? "" : Config::getGameInstallDirs().front();
Common::FS::PathToQString(install_dir, install_path);
m_gamesDirectory->setText(install_dir);
m_gamesDirectory->setMinimumWidth(400);
@ -125,7 +127,9 @@ void GameInstallDialog::Save() {
}
}
Config::setGameInstallDir(Common::FS::PathFromQString(gamesDirectory));
std::vector<std::filesystem::path> install_dirs;
install_dirs.emplace_back(Common::FS::PathFromQString(gamesDirectory));
Config::setGameInstallDirs(install_dirs);
Config::setAddonInstallDir(Common::FS::PathFromQString(addonsDirectory));
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
Config::save(config_dir / "config.toml");