diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index cb26f82..bdfa5de 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp @@ -694,7 +694,8 @@ std::string GetSysDirectory() { namespace { std::unordered_map g_paths; -} +bool g_portable_user_directory = false; +} // namespace void SetUserPath(const std::string& path) { if (!g_paths.empty()) { @@ -715,6 +716,7 @@ void SetUserPath(const std::string& path) { user_path = AppDataRoamingDirectory() + DIR_SEP EMU_DATA_DIR DIR_SEP; } else { LOG_INFO(Common_Filesystem, "Using the local user directory"); + g_portable_user_directory = true; } g_paths.emplace(UserPath::ConfigDir, user_path + CONFIG_DIR DIR_SEP); @@ -726,6 +728,9 @@ void SetUserPath(const std::string& path) { user_path = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP; g_paths.emplace(UserPath::ConfigDir, user_path + CONFIG_DIR DIR_SEP); g_paths.emplace(UserPath::CacheDir, user_path + CACHE_DIR DIR_SEP); + + LOG_INFO(Common_Filesystem, "Using the local user directory"); + g_portable_user_directory = true; } else { std::string data_dir = GetUserDirectory("XDG_DATA_HOME"); std::string config_dir = GetUserDirectory("XDG_CONFIG_HOME"); @@ -753,6 +758,10 @@ const std::string& GetUserPath(UserPath path) { return g_paths[path]; } +bool IsPortableUserDirectory() { + return g_portable_user_directory; +} + std::size_t WriteStringToFile(bool text_file, const std::string& filename, std::string_view str) { return IOFile(filename, text_file ? "w" : "wb").WriteString(str); } diff --git a/src/common/file_util.h b/src/common/file_util.h index 0fe24b9..15d5cf2 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h @@ -137,6 +137,9 @@ void SetUserPath(const std::string& path = ""); // directory. To be used in "multi-user" mode (that is, installed). const std::string& GetUserPath(UserPath path); +// Whetehr we are using the portable user directory. +bool IsPortableUserDirectory(); + // Returns the path to where the sys file are std::string GetSysDirectory(); diff --git a/src/frontend/main.cpp b/src/frontend/main.cpp index f9655fc..bd27cc8 100644 --- a/src/frontend/main.cpp +++ b/src/frontend/main.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -57,13 +56,10 @@ MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_uniqueimportDestination->setText( - QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::UserDir))); - connect(ui->importDestinationButton, &QPushButton::clicked, [this] { - QDesktopServices::openUrl(QUrl( - QStringLiteral("file:///%1") - .arg(QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::UserDir))))); - }); + ui->importDestination->setText(tr("Import Destination: %1") + .arg(FileUtil::IsPortableUserDirectory() + ? tr("Portable Citra Install") + : tr("User-wide Citra Install"))); connect(ui->main, &QTreeWidget::itemSelectionChanged, [this] { ui->buttonBox->button(QDialogButtonBox::StandardButton::Ok) diff --git a/src/frontend/main.ui b/src/frontend/main.ui index 0dc9b18..00c3c99 100644 --- a/src/frontend/main.ui +++ b/src/frontend/main.ui @@ -60,23 +60,9 @@ - - - - Files will be imported to: - - - - - - - Open - - -