Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.119
diff -u -r1.119 system.install
--- modules/system/system.install	30 May 2007 08:08:58 -0000	1.119
+++ modules/system/system.install	31 May 2007 12:38:16 -0000
@@ -3339,6 +3339,24 @@
 
   return $ret;
 }
+ /**
+ * Files directory now defaults to conf_path()/files so explicitly set
+ * file_directory_path to /files if files have aleady been uploaded to that
+ * directory.
+ */
+function system_update_6023() {
+  if (!variable_get('file_directory_path', '') && is_dir('files')) {
+    // File_directory_path has not been set and the files directory exists.
+    $files = db_fetch_object(db_query("SELECT COUNT(*) AS count FROM {files} f WHERE f.filepath LIKE 'files/%'"));
+    if ($files->count > 0) {
+      // At least one file has been uploaded to the files directory, so we need
+      // to explicitly set the variable now that the default has changed.
+      variable_set('file_directory_path', 'files');
+    }
+  }
+  return array();
+}
+
 /**
  * @} End of "defgroup updates-5.x-to-6.x"
  * The next series of updates should start at 7000.
Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.99
diff -u -r1.99 file.inc
--- includes/file.inc	30 May 2007 08:08:57 -0000	1.99
+++ includes/file.inc	31 May 2007 12:38:15 -0000
@@ -952,7 +952,7 @@
  * @return A string containing the path to Drupal's 'files' directory.
  */
 function file_directory_path() {
-  return variable_get('file_directory_path', 'files');
+  return variable_get('file_directory_path', conf_path() .'/files');
 }
 
 /**
Index: modules/color/color.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/color/color.module,v
retrieving revision 1.21
diff -u -r1.21 color.module
--- modules/color/color.module	28 May 2007 06:08:41 -0000	1.21
+++ modules/color/color.module	31 May 2007 12:38:15 -0000
@@ -238,7 +238,7 @@
 
   // Prepare target locations for generated files
   $id = $theme .'-'. substr(md5(serialize($palette) . microtime()), 0, 8);
-  $paths['color'] = variable_get('file_directory_path', 'files') .'/color';
+  $paths['color'] = file_directory_path() .'/color';
   $paths['target'] = $paths['color'] .'/'. $id;
   foreach ($paths as $path) {
     if (!is_dir($path)) {
