mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-02 16:49:04 +00:00
Fix up import destination indicator
This commit is contained in:
@@ -694,7 +694,8 @@ std::string GetSysDirectory() {
|
||||
|
||||
namespace {
|
||||
std::unordered_map<UserPath, std::string> 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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <QApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QStorageInfo>
|
||||
@@ -57,13 +56,10 @@ MainDialog::MainDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<U
|
||||
}
|
||||
});
|
||||
|
||||
ui->importDestination->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)
|
||||
|
||||
@@ -60,23 +60,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel">
|
||||
<property name="text">
|
||||
<string>Files will be imported to: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="importDestination"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="importDestinationButton">
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user