[gnome-games] retro: Set the save dir of the core



commit 2ffd5e5e46ba92f58b103fe4df81cbc5375a01a6
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu May 18 13:41:21 2017 +0200

    retro: Set the save dir of the core
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782772

 src/retro/retro-runner.vala |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 77b9b77..f542ee9 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -42,6 +42,7 @@ public class Games.RetroRunner : Object, Runner {
 
        private Gtk.EventBox widget;
 
+       private string save_directory_path;
        private string save_path;
        private string snapshot_path;
        private string screenshot_path;
@@ -277,6 +278,10 @@ public class Games.RetroRunner : Object, Runner {
                        var platforms_dir = Application.get_platforms_dir ();
                        var platform = core_source.get_platform ();
                        core.system_directory = @"$platforms_dir/$platform/system";
+
+                       var save_directory = get_save_directory_path ();
+                       try_make_dir (save_directory);
+                       core.save_directory = save_directory;
                }
 
                core.log.connect (Retro.g_log);
@@ -395,6 +400,17 @@ public class Games.RetroRunner : Object, Runner {
                should_save = false;
        }
 
+       private string get_save_directory_path () throws Error {
+               if (save_directory_path != null)
+                       return save_directory_path;
+
+               var dir = Application.get_saves_dir ();
+               var uid = uid.get_uid ();
+               save_directory_path = @"$dir/$uid";
+
+               return save_directory_path;
+       }
+
        private string get_save_path () throws Error {
                if (save_path != null)
                        return save_path;


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