[gimp] app: handle migration on OSX of GIMP 2.8.2's config folder.



commit 7ef45be8902a4b7403d1d1736ca4f7c95b6449a8
Author: Jehan <jehan girinstud io>
Date:   Thu Dec 5 00:20:32 2013 +1300

    app: handle migration on OSX of GIMP 2.8.2's config folder.
    
    GIMP 2.8.2's config was "~/Library/Gimp/x.y", before it got moved to
    "~/Library/Application Support/x.y" and after being saved in the home
    like other UNIXes. The migration code will now check all 3 places in the
    right order on OSX.
    Thanks to Simone Karin Lehmann for the original proposition.

 app/core/gimp-user-install.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimp-user-install.c b/app/core/gimp-user-install.c
index fc5cd7c..6c0a76e 100644
--- a/app/core/gimp-user-install.c
+++ b/app/core/gimp-user-install.c
@@ -34,6 +34,10 @@
 #include <unistd.h>
 #endif
 
+#ifdef PLATFORM_OSX
+#include <AppKit/AppKit.h>
+#endif
+
 #include <gio/gio.h>
 #include <glib/gstdio.h>
 
@@ -148,6 +152,35 @@ gimp_user_install_new (gboolean verbose)
 
   user_install_detect_old (install, gimp_directory ());
 
+#ifdef PLATFORM_OSX
+  /* The config path on OSX has for a very short time frame (2.8.2 only)
+     been "~/Library/GIMP". It changed to "~/Library/Application Support"
+     in 2.8.4 and was in the home folder (as was other UNIX) before. */
+
+  if (! install->old_dir)
+    {
+      gchar             *dir;
+      NSAutoreleasePool *pool;
+      NSArray           *path;
+      NSString          *library_dir;
+
+      pool = [[NSAutoreleasePool alloc] init];
+
+      path = NSSearchPathForDirectoriesInDomains (NSLibraryDirectory,
+                                                  NSUserDomainMask, YES);
+      library_dir = [path objectAtIndex:0];
+
+      dir = g_build_filename ([library_dir UTF8String],
+                              GIMPDIR, GIMP_USER_VERSION, NULL);
+
+      [pool drain];
+
+      user_install_detect_old (install, dir);
+      g_free (dir);
+    }
+
+#endif
+
   if (! install->old_dir)
     {
       /* if the default XDG-style config directory was not found, try


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