[shotwell] Use XDG_DATA_HOME instead of deprecated .gnome2



commit 8b3029e0476df8025e97191f9ec6b5e192482889
Author: Jens Georg <mail jensge org>
Date:   Sun May 15 21:12:37 2016 +0200

    Use XDG_DATA_HOME instead of deprecated .gnome2
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766339

 src/AppDirs.vala |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/AppDirs.vala b/src/AppDirs.vala
index bdc9282..bcda4ef 100644
--- a/src/AppDirs.vala
+++ b/src/AppDirs.vala
@@ -34,8 +34,29 @@ class AppDirs {
     }
     
     public static void try_migrate_data() {
+        // Migrate the user plugin dir from .gnome2 to .local
+        File user_plugin_dir = get_user_plugins_dir();
+        File old_dir =
+            get_home_dir().get_child(".gnome2").get_child("shotwell").get_child("plugins");
+
+        if (old_dir.query_exists() && !user_plugin_dir.get_parent().query_exists()) {
+            try {
+              user_plugin_dir.get_parent().make_directory_with_parents(null);
+            } catch (Error err) {
+                AppWindow.panic(_("Unable to create data directory %s: 
%s").printf(user_plugin_dir.get_parent().get_path(),
+                                                                                   err.message));
+            }
+        }
+
+        try {
+            old_dir.move(user_plugin_dir, FileCopyFlags.NONE);
+        } catch (Error err) {
+            AppWindow.panic(_("Unable to move plugin directory: %s").printf(err.message));
+        }
+
+
         File new_dir = get_data_dir();
-        File old_dir = get_home_dir().get_child(".shotwell");
+        old_dir = get_home_dir().get_child(".shotwell");
         if (new_dir.query_exists() || !old_dir.query_exists())
             return;
 
@@ -261,7 +282,7 @@ class AppDirs {
     }
     
     public static File get_user_plugins_dir() {
-        return get_home_dir().get_child(".gnome2").get_child("shotwell").get_child("plugins");
+        return get_data_dir().get_child("plugins");
     }
     
     public static File? get_log_file() {


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