[gnome-games] retro: Add RetroRunner.get_module_path()
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] retro: Add RetroRunner.get_module_path()
- Date: Thu, 11 Aug 2016 07:06:45 +0000 (UTC)
commit 59fa017a71a630743bf34e620f9006b39b62ab2e
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed Aug 10 15:30:50 2016 +0200
retro: Add RetroRunner.get_module_path()
Move the code looking for the modules to its own function.
This is needd to avoid cluttering prepare_core() as it will be expanded
in the next commit.
https://bugzilla.gnome.org/show_bug.cgi?id=769678
src/retro/retro-runner.vala | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index e760537..ce58451 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -156,11 +156,7 @@ public class Games.RetroRunner : Object, Runner {
}
private void prepare_core (string module_basename, string uri) throws Error {
- var module_path = Retro.search_module (module_basename);
- var module = File.new_for_path (module_path);
- if (!module.query_exists ())
- throw new RetroError.MODULE_NOT_FOUND (_("Couldn't run game: module '%s' not
found."), module_basename);
-
+ var module_path = get_module_path ();
core = new Retro.Core (module_path);
audio = new RetroGtk.PaPlayer ();
options = new Retro.Options ();
@@ -179,6 +175,15 @@ public class Games.RetroRunner : Object, Runner {
throw new RetroError.INVALID_GAME_FILE (_("Invalid game file: '%s'."), uri);
}
+ private string get_module_path () throws Error {
+ var module_path = Retro.search_module (module_basename);
+ var module = File.new_for_path (module_path);
+ if (module.query_exists ())
+ return module_path;
+
+ throw new RetroError.MODULE_NOT_FOUND (_("Couldn't run game: module '%s' not found."),
module_basename);
+ }
+
private bool try_load_game (Retro.Core core, string uri) {
var file = File.new_for_uri (uri);
var path = file.get_path ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]