[gnome-games] Fix module path checking



commit 774746725ed6a95643ea6d23836002ff9bb65c7b
Author: Mathieu Bridon <bochecha daitauha fr>
Date:   Sun Aug 14 16:00:14 2016 +0200

    Fix module path checking
    
    The code first checks for the retro core the legacy way, for
    compatibility.
    
    If it doesn't find anything, then it's supposed to search for the core
    by mimetypes.
    
    However, the Retro.search_module funciton returns null when the module
    is not found, and creating a GFile with a null path raises an assertion.
    
    In addition, we can use the FileUtils API which is nicer for us, as it
    removes the need to create a GFile.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769909

 src/retro/retro-runner.vala |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index e4c8c3b..bcaa25b 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -190,16 +190,16 @@ public class Games.RetroRunner : Object, Runner {
 
        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 ())
+
+               if (FileUtils.test (module_path, FileTest.EXISTS))
                        return module_path;
 
                if (mime_types.length == 0)
                        throw new RetroError.MODULE_NOT_FOUND (_("Couldn't run game: module '%s' not 
found."), module_basename);
 
                module_path = Retro.ModuleQuery.lookup_module_for_info (check_module_info);
-               module = File.new_for_path (module_path);
-               if (module.query_exists ())
+
+               if (FileUtils.test (module_path, FileTest.EXISTS))
                        return module_path;
 
                throw new RetroError.MODULE_NOT_FOUND (_("Couldn't run game: module '%s' not found and no 
module found for MIME types %s."), module_basename, string.joinv (" ", mime_types));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]