--- gstreamer-0.10.20/gst/gstpreset.c	2008-08-02 11:05:11.000000000 -0700
+++ gstreamer-0.10.20/gst/gstpreset.c	2008-08-02 11:07:19.000000000 -0700
@@ -124,10 +124,16 @@
   if (preset_user_path) {
     /* preset user path requested, see if we have it cached in the qdata */
     if (!(preset_path = g_type_get_qdata (type, preset_user_path_quark))) {
+      gchar *home_dir;
       gchar *preset_dir;
 
+      if (g_getenv ("HOME"))
+        home_dir = g_strdup (g_getenv ("HOME"));
+      else
+        home_dir = g_get_home_dir ();
+
       /* user presets go in '$HOME/.gstreamer-0.10/presets/GstSimSyn.prs' */
-      preset_dir = g_build_filename (g_get_home_dir (),
+      preset_dir = g_build_filename (home_dir,
           ".gstreamer-" GST_MAJORMINOR, "presets", NULL);
       GST_INFO_OBJECT (preset, "user_preset_dir: '%s'", preset_dir);
       preset_path =
@@ -137,6 +143,7 @@
       /* create dirs */
       g_mkdir_with_parents (preset_dir, 0755);
       g_free (preset_dir);
+      g_free (home_dir);
 
       /* cache the preset path to the type */
       g_type_set_qdata (type, preset_user_path_quark, preset_path);
@@ -148,9 +155,15 @@
     /* preset system path requested, see if we have it cached in the qdata */
     if (!(preset_path = g_type_get_qdata (type, preset_system_path_quark))) {
       gchar *preset_dir;
+      gchar *gst_datadir;
+
+      if (g_getenv ("GST_DATADIR"))
+        gst_datadir = g_strdup (g_getenv ("GST_DATADIR"));
+      else
+        gst_datadir = g_strdup (GST_DATADIR);
 
       /* system presets in '$GST_DATADIR/gstreamer-0.10/presets/GstAudioPanorama.prs' */
-      preset_dir = g_build_filename (GST_DATADIR, "gstreamer-" GST_MAJORMINOR,
+      preset_dir = g_build_filename (gst_datadir, "gstreamer-" GST_MAJORMINOR,
           "presets", NULL);
       GST_INFO_OBJECT (preset, "system_preset_dir: '%s'", preset_dir);
       preset_path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.prs",
@@ -159,6 +172,7 @@
       /* create dirs */
       g_mkdir_with_parents (preset_dir, 0755);
       g_free (preset_dir);
+      g_free (gst_datadir);
 
       /* cache the preset path to the type */
       g_type_set_qdata (type, preset_system_path_quark, preset_path);
