diff -ru -x '*~' libcompizconfig-0.8.4-orig/src/compiz.cpp libcompizconfig-0.8.4/src/compiz.cpp
--- libcompizconfig-0.8.4-orig/src/compiz.cpp	2009-10-14 02:36:04.000000000 +0200
+++ libcompizconfig-0.8.4/src/compiz.cpp	2010-10-20 00:35:28.000000000 +0200
@@ -3004,7 +3004,10 @@
 	    }
 	}
 
-	loadPluginFromXMLFile (context, xmlName, (char *) METADATADIR);
+        char *metadatadir = getenv("COMPIZ_METADATADIR");
+        if (!metadatadir) metadatadir = METADATADIR;
+
+	loadPluginFromXMLFile (context, xmlName, metadatadir);
 	free (xmlName);
     }
 
@@ -3031,7 +3034,10 @@
 	    free (homeplugins);
 	}
     }
-    loadPluginsFromXMLFiles (context, (char *)METADATADIR);
+    
+    char *metadatadir = getenv("COMPIZ_METADATADIR");
+    if (!metadatadir) metadatadir = METADATADIR;
+    loadPluginsFromXMLFiles (context, metadatadir);
 
     if (home && strlen (home))
     {
@@ -3043,7 +3049,10 @@
 	    free (homeplugins);
 	}
     }
-    loadPluginsFromName (context, (char *)PLUGINDIR);
+
+    char *plugindir = getenv("COMPIZ_PLUGINDIR");
+    if (!plugindir) plugindir = PLUGINDIR;
+    loadPluginsFromName (context, plugindir);
 }
 
 static void
