diff options
Diffstat (limited to 'src/yuzu/configuration')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 105 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_cpu.ui | 6 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_debug.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_filesystem.cpp | 39 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_per_game.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_per_game_addons.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_profile_manager.cpp | 13 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_ui.cpp | 23 | ||||
| -rw-r--r-- | src/yuzu/configuration/input_profiles.cpp | 58 | 
10 files changed, 134 insertions, 125 deletions
| diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 125feb86b..eb58bfa5b 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -5,8 +5,8 @@  #include <array>  #include <QKeySequence>  #include <QSettings> -#include "common/common_paths.h" -#include "common/file_util.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h"  #include "core/core.h"  #include "core/hle/service/acc/profile_manager.h"  #include "core/hle/service/hid/controllers/npad.h" @@ -243,27 +243,27 @@ const std::array<UISettings::Shortcut, 17> Config::default_hotkeys{{  // clang-format on  void Config::Initialize(const std::string& config_name) { +    const auto fs_config_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir); +    const auto config_file = fmt::format("{}.ini", config_name); +      switch (type) {      case ConfigType::GlobalConfig: -        qt_config_loc = fmt::format("{}" DIR_SEP "{}.ini", FS::GetUserPath(FS::UserPath::ConfigDir), -                                    config_name); -        FS::CreateFullPath(qt_config_loc); +        qt_config_loc = FS::PathToUTF8String(fs_config_loc / config_file); +        void(FS::CreateParentDir(qt_config_loc));          qt_config = std::make_unique<QSettings>(QString::fromStdString(qt_config_loc),                                                  QSettings::IniFormat);          Reload();          break;      case ConfigType::PerGameConfig: -        qt_config_loc = fmt::format("{}custom" DIR_SEP "{}.ini", -                                    FS::GetUserPath(FS::UserPath::ConfigDir), config_name); -        FS::CreateFullPath(qt_config_loc); +        qt_config_loc = FS::PathToUTF8String(fs_config_loc / "custom" / config_file); +        void(FS::CreateParentDir(qt_config_loc));          qt_config = std::make_unique<QSettings>(QString::fromStdString(qt_config_loc),                                                  QSettings::IniFormat);          Reload();          break;      case ConfigType::InputProfile: -        qt_config_loc = fmt::format("{}input" DIR_SEP "{}.ini", -                                    FS::GetUserPath(FS::UserPath::ConfigDir), config_name); -        FS::CreateFullPath(qt_config_loc); +        qt_config_loc = FS::PathToUTF8String(fs_config_loc / "input" / config_file); +        void(FS::CreateParentDir(qt_config_loc));          qt_config = std::make_unique<QSettings>(QString::fromStdString(qt_config_loc),                                                  QSettings::IniFormat);          break; @@ -514,6 +514,13 @@ void Config::ReadControlValues() {          ReadSetting(QStringLiteral("mouse_panning_sensitivity"), 1).toFloat();      ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), true); + +    // Disable docked mode if handheld is selected +    const auto controller_type = Settings::values.players.GetValue()[0].controller_type; +    if (controller_type == Settings::ControllerType::Handheld) { +        Settings::values.use_docked_mode.SetValue(false); +    } +      ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"),                        true);      ReadSettingGlobal(Settings::values.enable_accurate_vibrations, @@ -591,30 +598,34 @@ void Config::ReadDataStorageValues() {      qt_config->beginGroup(QStringLiteral("Data Storage"));      Settings::values.use_virtual_sd = ReadSetting(QStringLiteral("use_virtual_sd"), true).toBool(); -    FS::GetUserPath(FS::UserPath::NANDDir, -                    qt_config -                        ->value(QStringLiteral("nand_directory"), -                                QString::fromStdString(FS::GetUserPath(FS::UserPath::NANDDir))) -                        .toString() -                        .toStdString()); -    FS::GetUserPath(FS::UserPath::SDMCDir, -                    qt_config -                        ->value(QStringLiteral("sdmc_directory"), -                                QString::fromStdString(FS::GetUserPath(FS::UserPath::SDMCDir))) -                        .toString() -                        .toStdString()); -    FS::GetUserPath(FS::UserPath::LoadDir, -                    qt_config -                        ->value(QStringLiteral("load_directory"), -                                QString::fromStdString(FS::GetUserPath(FS::UserPath::LoadDir))) -                        .toString() -                        .toStdString()); -    FS::GetUserPath(FS::UserPath::DumpDir, -                    qt_config -                        ->value(QStringLiteral("dump_directory"), -                                QString::fromStdString(FS::GetUserPath(FS::UserPath::DumpDir))) -                        .toString() -                        .toStdString()); +    FS::SetYuzuPath( +        FS::YuzuPath::NANDDir, +        qt_config +            ->value(QStringLiteral("nand_directory"), +                    QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::NANDDir))) +            .toString() +            .toStdString()); +    FS::SetYuzuPath( +        FS::YuzuPath::SDMCDir, +        qt_config +            ->value(QStringLiteral("sdmc_directory"), +                    QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::SDMCDir))) +            .toString() +            .toStdString()); +    FS::SetYuzuPath( +        FS::YuzuPath::LoadDir, +        qt_config +            ->value(QStringLiteral("load_directory"), +                    QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::LoadDir))) +            .toString() +            .toStdString()); +    FS::SetYuzuPath( +        FS::YuzuPath::DumpDir, +        qt_config +            ->value(QStringLiteral("dump_directory"), +                    QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir))) +            .toString() +            .toStdString());      Settings::values.gamecard_inserted =          ReadSetting(QStringLiteral("gamecard_inserted"), false).toBool();      Settings::values.gamecard_current_game = @@ -810,11 +821,11 @@ void Config::ReadScreenshotValues() {      UISettings::values.enable_screenshot_save_as =          ReadSetting(QStringLiteral("enable_screenshot_save_as"), true).toBool(); -    FS::GetUserPath( -        FS::UserPath::ScreenshotsDir, +    FS::SetYuzuPath( +        FS::YuzuPath::ScreenshotsDir,          qt_config              ->value(QStringLiteral("screenshot_path"), -                    QString::fromStdString(FS::GetUserPath(FS::UserPath::ScreenshotsDir))) +                    QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::ScreenshotsDir)))              .toString()              .toStdString()); @@ -1213,17 +1224,17 @@ void Config::SaveDataStorageValues() {      WriteSetting(QStringLiteral("use_virtual_sd"), Settings::values.use_virtual_sd, true);      WriteSetting(QStringLiteral("nand_directory"), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::NANDDir)), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::NANDDir))); +                 QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::NANDDir)), +                 QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::NANDDir)));      WriteSetting(QStringLiteral("sdmc_directory"), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::SDMCDir)), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::SDMCDir))); +                 QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::SDMCDir)), +                 QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::SDMCDir)));      WriteSetting(QStringLiteral("load_directory"), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::LoadDir)), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::LoadDir))); +                 QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::LoadDir)), +                 QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::LoadDir)));      WriteSetting(QStringLiteral("dump_directory"), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::DumpDir)), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::DumpDir))); +                 QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir)), +                 QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::DumpDir)));      WriteSetting(QStringLiteral("gamecard_inserted"), Settings::values.gamecard_inserted, false);      WriteSetting(QStringLiteral("gamecard_current_game"), Settings::values.gamecard_current_game,                   false); @@ -1390,7 +1401,7 @@ void Config::SaveScreenshotValues() {      WriteSetting(QStringLiteral("enable_screenshot_save_as"),                   UISettings::values.enable_screenshot_save_as);      WriteSetting(QStringLiteral("screenshot_path"), -                 QString::fromStdString(FS::GetUserPath(FS::UserPath::ScreenshotsDir))); +                 QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::ScreenshotsDir)));      qt_config->endGroup();  } diff --git a/src/yuzu/configuration/configure_cpu.ui b/src/yuzu/configuration/configure_cpu.ui index d0e7e7bfe..99b573640 100644 --- a/src/yuzu/configuration/configure_cpu.ui +++ b/src/yuzu/configuration/configure_cpu.ui @@ -26,7 +26,7 @@           <widget class="QWidget" name="widget_accuracy" native="true">            <layout class="QHBoxLayout" name="layout_accuracy">             <item> -            <widget class="QLabel" name="label"> +            <widget class="QLabel" name="label_accuracy">               <property name="text">                <string>Accuracy:</string>               </property> @@ -55,7 +55,7 @@           </widget>          </item>          <item> -         <widget class="QLabel" name="label"> +         <widget class="QLabel" name="label_recommended_accuracy">            <property name="text">             <string>We recommend setting accuracy to "Accurate".</string>            </property> @@ -78,7 +78,7 @@         </property>         <layout class="QVBoxLayout">          <item> -         <widget class="QLabel" name="label"> +         <widget class="QLabel" name="label_accuracy_description">            <property name="text">             <string>These settings reduce accuracy for speed.</string>            </property> diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index 6730eb356..b207e07cb 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp @@ -4,7 +4,7 @@  #include <QDesktopServices>  #include <QUrl> -#include "common/file_util.h" +#include "common/fs/path_util.h"  #include "common/logging/backend.h"  #include "common/logging/filter.h"  #include "common/settings.h" @@ -20,7 +20,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co      connect(ui->open_log_button, &QPushButton::clicked, []() {          const auto path = -            QString::fromStdString(Common::FS::GetUserPath(Common::FS::UserPath::LogDir)); +            QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LogDir));          QDesktopServices::openUrl(QUrl::fromLocalFile(path));      });  } diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp index 006eda4b0..d223c40ea 100644 --- a/src/yuzu/configuration/configure_filesystem.cpp +++ b/src/yuzu/configuration/configure_filesystem.cpp @@ -4,8 +4,8 @@  #include <QFileDialog>  #include <QMessageBox> -#include "common/common_paths.h" -#include "common/file_util.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h"  #include "common/settings.h"  #include "ui_configure_filesystem.h"  #include "yuzu/configuration/configure_filesystem.h" @@ -40,14 +40,14 @@ ConfigureFilesystem::~ConfigureFilesystem() = default;  void ConfigureFilesystem::setConfiguration() {      ui->nand_directory_edit->setText( -        QString::fromStdString(Common::FS::GetUserPath(Common::FS::UserPath::NANDDir))); +        QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::NANDDir)));      ui->sdmc_directory_edit->setText( -        QString::fromStdString(Common::FS::GetUserPath(Common::FS::UserPath::SDMCDir))); +        QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::SDMCDir)));      ui->gamecard_path_edit->setText(QString::fromStdString(Settings::values.gamecard_path));      ui->dump_path_edit->setText( -        QString::fromStdString(Common::FS::GetUserPath(Common::FS::UserPath::DumpDir))); +        QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::DumpDir)));      ui->load_path_edit->setText( -        QString::fromStdString(Common::FS::GetUserPath(Common::FS::UserPath::LoadDir))); +        QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LoadDir)));      ui->gamecard_inserted->setChecked(Settings::values.gamecard_inserted);      ui->gamecard_current_game->setChecked(Settings::values.gamecard_current_game); @@ -60,13 +60,13 @@ void ConfigureFilesystem::setConfiguration() {  }  void ConfigureFilesystem::applyConfiguration() { -    Common::FS::GetUserPath(Common::FS::UserPath::NANDDir, +    Common::FS::SetYuzuPath(Common::FS::YuzuPath::NANDDir,                              ui->nand_directory_edit->text().toStdString()); -    Common::FS::GetUserPath(Common::FS::UserPath::SDMCDir, +    Common::FS::SetYuzuPath(Common::FS::YuzuPath::SDMCDir,                              ui->sdmc_directory_edit->text().toStdString()); -    Common::FS::GetUserPath(Common::FS::UserPath::DumpDir, +    Common::FS::SetYuzuPath(Common::FS::YuzuPath::DumpDir,                              ui->dump_path_edit->text().toStdString()); -    Common::FS::GetUserPath(Common::FS::UserPath::LoadDir, +    Common::FS::SetYuzuPath(Common::FS::YuzuPath::LoadDir,                              ui->load_path_edit->text().toStdString());      Settings::values.gamecard_inserted = ui->gamecard_inserted->isChecked(); @@ -104,25 +104,26 @@ void ConfigureFilesystem::SetDirectory(DirectoryTarget target, QLineEdit* edit)                                             QStringLiteral("NX Gamecard;*.xci"));      } else {          str = QFileDialog::getExistingDirectory(this, caption, edit->text()); -        if (!str.isNull() && str.back() != QDir::separator()) { -            str.append(QDir::separator()); -        }      } -    if (str.isEmpty()) +    if (str.isNull() || str.isEmpty()) {          return; +    } + +    if (str.back() != QChar::fromLatin1('/')) { +        str.append(QChar::fromLatin1('/')); +    }      edit->setText(str);  }  void ConfigureFilesystem::ResetMetadata() { -    if (!Common::FS::Exists(Common::FS::GetUserPath(Common::FS::UserPath::CacheDir) + DIR_SEP + -                            "game_list")) { +    if (!Common::FS::Exists(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / +                            "game_list/")) {          QMessageBox::information(this, tr("Reset Metadata Cache"),                                   tr("The metadata cache is already empty.")); -    } else if (Common::FS::DeleteDirRecursively( -                   Common::FS::GetUserPath(Common::FS::UserPath::CacheDir) + DIR_SEP + -                   "game_list")) { +    } else if (Common::FS::RemoveDirRecursively( +                   Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / "game_list")) {          QMessageBox::information(this, tr("Reset Metadata Cache"),                                   tr("The operation completed successfully."));          UISettings::values.is_game_list_reload_pending.exchange(true); diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index f550567e2..3e13bd438 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp @@ -14,8 +14,6 @@  #include <QTimer>  #include <QTreeView> -#include "common/common_paths.h" -#include "common/file_util.h"  #include "core/core.h"  #include "core/file_sys/control_metadata.h"  #include "core/file_sys/patch_manager.h" diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp index cdeeec01c..9b709d405 100644 --- a/src/yuzu/configuration/configure_per_game_addons.cpp +++ b/src/yuzu/configuration/configure_per_game_addons.cpp @@ -13,8 +13,8 @@  #include <QTimer>  #include <QTreeView> -#include "common/common_paths.h" -#include "common/file_util.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h"  #include "core/core.h"  #include "core/file_sys/patch_manager.h"  #include "core/file_sys/xts_archive.h" @@ -79,8 +79,8 @@ void ConfigurePerGameAddons::ApplyConfiguration() {      std::sort(disabled_addons.begin(), disabled_addons.end());      std::sort(current.begin(), current.end());      if (disabled_addons != current) { -        Common::FS::Delete(Common::FS::GetUserPath(Common::FS::UserPath::CacheDir) + DIR_SEP + -                           "game_list" + DIR_SEP + fmt::format("{:016X}.pv.txt", title_id)); +        void(Common::FS::RemoveFile(Common::FS::GetYuzuPath(Common::FS::YuzuPath::CacheDir) / +                                    "game_list" / fmt::format("{:016X}.pv.txt", title_id)));      }      Settings::values.disabled_addons[title_id] = disabled_addons; diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index d61b5e29b..f5881e58d 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp @@ -12,7 +12,7 @@  #include <QTreeView>  #include <QVBoxLayout>  #include "common/assert.h" -#include "common/file_util.h" +#include "common/fs/path_util.h"  #include "common/settings.h"  #include "common/string_util.h"  #include "core/core.h" @@ -34,9 +34,10 @@ constexpr std::array<u8, 107> backup_jpeg{  };  QString GetImagePath(Common::UUID uuid) { -    const auto path = Common::FS::GetUserPath(Common::FS::UserPath::NANDDir) + -                      "/system/save/8000000000000010/su/avators/" + uuid.FormatSwitch() + ".jpg"; -    return QString::fromStdString(path); +    const auto path = +        Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / +        fmt::format("system/save/8000000000000010/su/avators/{}.jpg", uuid.FormatSwitch()); +    return QString::fromStdString(Common::FS::PathToUTF8String(path));  }  QString GetAccountUsername(const Service::Account::ProfileManager& manager, Common::UUID uuid) { @@ -281,8 +282,8 @@ void ConfigureProfileManager::SetUserImage() {          return;      } -    const auto raw_path = QString::fromStdString( -        Common::FS::GetUserPath(Common::FS::UserPath::NANDDir) + "/system/save/8000000000000010"); +    const auto raw_path = QString::fromStdString(Common::FS::PathToUTF8String( +        Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/8000000000000010"));      const QFileInfo raw_info{raw_path};      if (raw_info.exists() && !raw_info.isDir() && !QFile::remove(raw_path)) {          QMessageBox::warning(this, tr("Error deleting file"), diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 85418f969..99a5df241 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -10,7 +10,6 @@  #include <QGraphicsItem>  #include <QMessageBox>  #include "common/assert.h" -#include "common/file_util.h"  #include "common/settings.h"  #include "core/core.h"  #include "core/hle/service/time/time.h" diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 0cdaea8a4..0a28c87c0 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -8,7 +8,7 @@  #include <QDirIterator>  #include "common/common_types.h" -#include "common/file_util.h" +#include "common/fs/path_util.h"  #include "common/settings.h"  #include "core/core.h"  #include "ui_configure_ui.h" @@ -62,13 +62,16 @@ ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::Configur      // Set screenshot path to user specification.      connect(ui->screenshot_path_button, &QToolButton::pressed, this, [this] { -        const QString& filename = +        auto dir =              QFileDialog::getExistingDirectory(this, tr("Select Screenshots Path..."), -                                              QString::fromStdString(Common::FS::GetUserPath( -                                                  Common::FS::UserPath::ScreenshotsDir))) + -            QDir::separator(); -        if (!filename.isEmpty()) { -            ui->screenshot_path_edit->setText(filename); +                                              QString::fromStdString(Common::FS::GetYuzuPathString( +                                                  Common::FS::YuzuPath::ScreenshotsDir))); +        if (!dir.isEmpty()) { +            if (dir.back() != QChar::fromLatin1('/')) { +                dir.append(QChar::fromLatin1('/')); +            } + +            ui->screenshot_path_edit->setText(dir);          }      });  } @@ -84,7 +87,7 @@ void ConfigureUi::ApplyConfiguration() {      UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt();      UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked(); -    Common::FS::GetUserPath(Common::FS::UserPath::ScreenshotsDir, +    Common::FS::SetYuzuPath(Common::FS::YuzuPath::ScreenshotsDir,                              ui->screenshot_path_edit->text().toStdString());      Core::System::GetInstance().ApplySettings();  } @@ -102,8 +105,8 @@ void ConfigureUi::SetConfiguration() {          ui->icon_size_combobox->findData(UISettings::values.icon_size));      ui->enable_screenshot_save_as->setChecked(UISettings::values.enable_screenshot_save_as); -    ui->screenshot_path_edit->setText( -        QString::fromStdString(Common::FS::GetUserPath(Common::FS::UserPath::ScreenshotsDir))); +    ui->screenshot_path_edit->setText(QString::fromStdString( +        Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)));  }  void ConfigureUi::changeEvent(QEvent* event) { diff --git a/src/yuzu/configuration/input_profiles.cpp b/src/yuzu/configuration/input_profiles.cpp index e87aededb..333eeb84e 100644 --- a/src/yuzu/configuration/input_profiles.cpp +++ b/src/yuzu/configuration/input_profiles.cpp @@ -4,8 +4,8 @@  #include <fmt/format.h> -#include "common/common_paths.h" -#include "common/file_util.h" +#include "common/fs/fs.h" +#include "common/fs/path_util.h"  #include "yuzu/configuration/config.h"  #include "yuzu/configuration/input_profiles.h" @@ -14,47 +14,43 @@ namespace FS = Common::FS;  namespace {  bool ProfileExistsInFilesystem(std::string_view profile_name) { -    return FS::Exists(fmt::format("{}input" DIR_SEP "{}.ini", -                                  FS::GetUserPath(FS::UserPath::ConfigDir), profile_name)); +    return FS::Exists(FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "input" / +                      fmt::format("{}.ini", profile_name));  } -bool IsINI(std::string_view filename) { -    const std::size_t index = filename.rfind('.'); - -    if (index == std::string::npos) { -        return false; -    } - -    return filename.substr(index) == ".ini"; +bool IsINI(const std::filesystem::path& filename) { +    return filename.extension() == ".ini";  } -std::string GetNameWithoutExtension(const std::string& filename) { -    const std::size_t index = filename.rfind('.'); - -    if (index == std::string::npos) { -        return filename; -    } - -    return filename.substr(0, index); +std::filesystem::path GetNameWithoutExtension(std::filesystem::path filename) { +    return filename.replace_extension();  }  } // namespace  InputProfiles::InputProfiles() { -    const std::string input_profile_loc = -        fmt::format("{}input", FS::GetUserPath(FS::UserPath::ConfigDir)); +    const auto input_profile_loc = FS::GetYuzuPath(FS::YuzuPath::ConfigDir) / "input"; + +    if (!FS::IsDir(input_profile_loc)) { +        return; +    } -    FS::ForeachDirectoryEntry( -        nullptr, input_profile_loc, -        [this](u64* entries_out, const std::string& directory, const std::string& filename) { -            if (IsINI(filename) && IsProfileNameValid(GetNameWithoutExtension(filename))) { +    FS::IterateDirEntries( +        input_profile_loc, +        [this](const std::filesystem::path& full_path) { +            const auto filename = full_path.filename(); +            const auto name_without_ext = +                Common::FS::PathToUTF8String(GetNameWithoutExtension(filename)); + +            if (IsINI(filename) && IsProfileNameValid(name_without_ext)) {                  map_profiles.insert_or_assign( -                    GetNameWithoutExtension(filename), -                    std::make_unique<Config>(GetNameWithoutExtension(filename), -                                             Config::ConfigType::InputProfile)); +                    name_without_ext, +                    std::make_unique<Config>(name_without_ext, Config::ConfigType::InputProfile));              } +              return true; -        }); +        }, +        FS::DirEntryFilter::File);  }  InputProfiles::~InputProfiles() = default; @@ -96,7 +92,7 @@ bool InputProfiles::DeleteProfile(const std::string& profile_name) {      }      if (!ProfileExistsInFilesystem(profile_name) || -        FS::Delete(map_profiles[profile_name]->GetConfigFilePath())) { +        FS::RemoveFile(map_profiles[profile_name]->GetConfigFilePath())) {          map_profiles.erase(profile_name);      } | 
