mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-01-09 08:29:20 +01:00
Fixed incorrect applications directory path while using Flatpak build
This commit is contained in:
parent
3262515c89
commit
a573f0f036
@ -1,7 +1,10 @@
|
|||||||
// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
|
// Copyright Citra Emulator Project / Lime3DS Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
// Copyright Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -707,8 +710,8 @@ std::string AppDataRoamingDirectory() {
|
|||||||
/**
|
/**
|
||||||
* @return The user’s home directory on POSIX systems
|
* @return The user’s home directory on POSIX systems
|
||||||
*/
|
*/
|
||||||
static const std::string& GetHomeDirectory() {
|
const std::string GetHomeDirectory() {
|
||||||
static std::string home_path;
|
std::string home_path;
|
||||||
if (home_path.empty()) {
|
if (home_path.empty()) {
|
||||||
const char* envvar = getenv("HOME");
|
const char* envvar = getenv("HOME");
|
||||||
if (envvar) {
|
if (envvar) {
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
|
// Copyright Citra Emulator Project / Lime3DS Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
// Copyright Dolphin Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
@ -207,6 +210,7 @@ void UpdateUserPath(UserPath path, const std::string& filename);
|
|||||||
[[nodiscard]] const std::string& GetExeDirectory();
|
[[nodiscard]] const std::string& GetExeDirectory();
|
||||||
[[nodiscard]] std::string AppDataRoamingDirectory();
|
[[nodiscard]] std::string AppDataRoamingDirectory();
|
||||||
#else
|
#else
|
||||||
|
[[nodiscard]] const std::string GetHomeDirectory();
|
||||||
[[nodiscard]] const std::string GetUserDirectory(const std::string& envvar);
|
[[nodiscard]] const std::string GetUserDirectory(const std::string& envvar);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright Citra Emulator Project / Lime3DS Emulator Project
|
// Copyright 2014 Citra Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
@ -1947,8 +1947,7 @@ void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& ga
|
|||||||
shortcut_path =
|
shortcut_path =
|
||||||
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation).toStdString();
|
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation).toStdString();
|
||||||
} else if (target == GameListShortcutTarget::Applications) {
|
} else if (target == GameListShortcutTarget::Applications) {
|
||||||
shortcut_path =
|
shortcut_path = GetApplicationsDirectory();
|
||||||
QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation).toStdString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Icon path and title
|
// Icon path and title
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
// Copyright 2015 Citra Emulator Project
|
// Copyright Citra Emulator Project / Lime3DS Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include "common/common_paths.h"
|
||||||
|
#include "common/file_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/loader/smdh.h"
|
#include "core/loader/smdh.h"
|
||||||
#include "lime_qt/util/util.h"
|
#include "lime_qt/util/util.h"
|
||||||
@ -160,3 +163,15 @@ bool SaveIconToFile(const std::filesystem::path& icon_path, const QImage& image)
|
|||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string GetApplicationsDirectory() {
|
||||||
|
// This alternate method is required for Flatpak compatibility as
|
||||||
|
// QStandardPaths::ApplicationsLocation returns a path inside the Flatpak data directory instead of
|
||||||
|
// $HOME/.local/share
|
||||||
|
#if defined(__linux__) || defined(__FreeBSD__)
|
||||||
|
return FileUtil::GetHomeDirectory() + DIR_SEP + ".local" + DIR_SEP + "share" + DIR_SEP +
|
||||||
|
"applications";
|
||||||
|
#else
|
||||||
|
return QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation).toStdString();
|
||||||
|
#endif
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright 2015 Citra Emulator Project
|
// Copyright Citra Emulator Project / Lime3DS Emulator Project
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
@ -36,3 +36,8 @@ QPixmap GetQPixmapFromSMDH(const std::vector<u8>& smdh_data);
|
|||||||
* @return bool If the operation succeeded
|
* @return bool If the operation succeeded
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] bool SaveIconToFile(const std::filesystem::path& icon_path, const QImage& image);
|
[[nodiscard]] bool SaveIconToFile(const std::filesystem::path& icon_path, const QImage& image);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The user’s applications directory
|
||||||
|
*/
|
||||||
|
[[nodiscard]] const std::string GetApplicationsDirectory();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user