From 7ef45be8902a4b7403d1d1736ca4f7c95b6449a8 Mon Sep 17 00:00:00 2001 From: Jehan Date: Thu, 5 Dec 2013 00:20:32 +1300 Subject: [PATCH] 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 file changed, 33 insertions(+) diff --git a/app/core/gimp-user-install.c b/app/core/gimp-user-install.c index fc5cd7c2ad..6c0a76e8d3 100644 --- a/app/core/gimp-user-install.c +++ b/app/core/gimp-user-install.c @@ -34,6 +34,10 @@ #include #endif +#ifdef PLATFORM_OSX +#include +#endif + #include #include @@ -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