mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp
synced 2026-07-05 13:44:03 -04:00
Add flatpak support.
This commit is contained in:
+2
-1
@@ -608,7 +608,8 @@ int main(int argc, char** argv) {
|
||||
reset_audio(48000);
|
||||
|
||||
// Source controller mappings file
|
||||
if (SDL_GameControllerAddMappingsFromFile("recompcontrollerdb.txt") < 0) {
|
||||
std::u8string controller_db_path = (zelda64::get_program_path() / "recompcontrollerdb.txt").u8string();
|
||||
if (SDL_GameControllerAddMappingsFromFile(reinterpret_cast<const char *>(controller_db_path.c_str())) < 0) {
|
||||
fprintf(stderr, "Failed to load controller mappings: %s\n", SDL_GetError());
|
||||
}
|
||||
|
||||
|
||||
+11
-4
@@ -45,13 +45,20 @@ namespace zelda64 {
|
||||
|
||||
// MARK: - Public API
|
||||
|
||||
std::filesystem::path get_asset_path(const char* asset) {
|
||||
std::filesystem::path base_path = "";
|
||||
std::filesystem::path get_program_path() {
|
||||
#if defined(__APPLE__)
|
||||
base_path = get_bundle_resource_directory();
|
||||
return get_bundle_resource_directory();
|
||||
#elif defined(__linux__)
|
||||
std::error_code ec;
|
||||
if (std::filesystem::exists("/.flatpak-info", ec)) {
|
||||
return "/app/bin";
|
||||
}
|
||||
#endif
|
||||
return "";
|
||||
}
|
||||
|
||||
return base_path / "assets" / asset;
|
||||
std::filesystem::path get_asset_path(const char* asset) {
|
||||
return get_program_path() / "assets" / asset;
|
||||
}
|
||||
|
||||
void open_file_dialog(std::function<void(bool success, const std::filesystem::path& path)> callback) {
|
||||
|
||||
Reference in New Issue
Block a user