--- glib/gosxutils.m.orig	2022-03-17 23:01:31.000000000 +0800
+++ glib/gosxutils.m	2022-04-04 05:41:18.000000000 +0800
@@ -21,17 +21,31 @@
 #include "gutils.h"
 #include "gstrfuncs.h"
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
+#define POOLSTART NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+#define POOLEND   [pool release];
+#else
+#define POOLSTART
+#define POOLEND
+#endif
+
 void load_user_special_dirs_macos (gchar **table);
 
 static gchar *
 find_folder (NSSearchPathDirectory type)
 {
+POOLSTART
+
   gchar *filename;
   NSString *path;
   NSArray *paths;
 
   paths = NSSearchPathForDirectoriesInDomains (type, NSUserDomainMask, YES);
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
   path = [paths firstObject];
+#else
+  path = [paths count] ? [paths objectAtIndex:0] : NULL;
+#endif
   if (path == nil)
     {
       return NULL;
@@ -39,6 +53,8 @@
 
   filename = g_strdup ([path UTF8String]);
 
+POOLEND
+
   return filename;
 }
 
@@ -47,10 +63,37 @@
 {
   table[G_USER_DIRECTORY_DESKTOP] = find_folder (NSDesktopDirectory);
   table[G_USER_DIRECTORY_DOCUMENTS] = find_folder (NSDocumentDirectory);
+  
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
+  
   table[G_USER_DIRECTORY_DOWNLOAD] = find_folder (NSDownloadsDirectory);
   table[G_USER_DIRECTORY_MUSIC] = find_folder (NSMusicDirectory);
   table[G_USER_DIRECTORY_PICTURES] = find_folder (NSPicturesDirectory);
   table[G_USER_DIRECTORY_PUBLIC_SHARE] = find_folder (NSSharedPublicDirectory);
   table[G_USER_DIRECTORY_TEMPLATES] = NULL;
   table[G_USER_DIRECTORY_VIDEOS] = find_folder (NSMoviesDirectory);
-}
+
+#else
+POOLSTART
+
+  /* for Tiger and Leopard we have to emulate some by finding the home folder and appending the needed SubFolder name
+     even with different languages, these still have the same names to the system; they are just displayed differently
+  */
+
+# if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+    table[G_USER_DIRECTORY_DOWNLOAD] = find_folder (NSDownloadsDirectory);
+# else
+    /* for Tiger there is no DownloadsDir, so we use Desktop as glib did previously */
+    table[G_USER_DIRECTORY_DOWNLOAD] = find_folder (NSDesktopDirectory);
+# endif
+
+  table[G_USER_DIRECTORY_MUSIC] = g_strdup ([[NSHomeDirectory() stringByAppendingPathComponent:@"Music"] UTF8String]);
+  table[G_USER_DIRECTORY_PICTURES] = g_strdup ([[NSHomeDirectory() stringByAppendingPathComponent:@"Pictures"] UTF8String]);
+  table[G_USER_DIRECTORY_PUBLIC_SHARE] = g_strdup ([[NSHomeDirectory() stringByAppendingPathComponent:@"Public"] UTF8String]);
+  table[G_USER_DIRECTORY_TEMPLATES] = NULL;
+  table[G_USER_DIRECTORY_VIDEOS] = g_strdup ([[NSHomeDirectory() stringByAppendingPathComponent:@"Movies"] UTF8String]);
+
+POOLEND
+
+#endif
+}
\ No newline at end of file
