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



commit cfe5c483f73890470b0e43f51c70b423edf1ce0d
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.
    (cherry picked from commit 7ef45be8902a4b7403d1d1736ca4f7c95b6449a8)

 app/core/gimp-user-install.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimp-user-install.c b/app/core/gimp-user-install.c
index e37648e..5703511 100644
--- a/app/core/gimp-user-install.c
+++ b/app/core/gimp-user-install.c
@@ -36,6 +36,10 @@
 
 #include <glib/gstdio.h>
 
+#ifdef PLATFORM_OSX
+#include <AppKit/AppKit.h>
+#endif
+
 #include <glib-object.h>
 
 #ifdef G_OS_WIN32
@@ -144,6 +148,32 @@ gimp_user_install_new (gboolean verbose)
   gimp_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];
+
+      gimp_user_install_detect_old (install, dir);
+      g_free (dir);
+    }
+
   if (! install->old_dir)
     {
       /*  if the default old gimpdir was not found, try the "classic" one


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