Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.124
diff -u -r1.124 system.install
--- modules/system/system.install	26 Jun 2007 20:24:19 -0000	1.124
+++ modules/system/system.install	29 Jun 2007 09:52:17 -0000
@@ -3421,6 +3421,24 @@
 }
 
 /**
+ * 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_6025() {
+  if (!variable_get('file_directory_path', '') && is_dir('files')) {
+    // File_directory_path has not been set and the files directory exists.
+    $count = db_result(db_query("SELECT COUNT(*) FROM {files} f WHERE f.filepath LIKE 'files/%%'"));
+    if ($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.101
diff -u -r1.101 file.inc
--- includes/file.inc	5 Jun 2007 12:13:20 -0000	1.101
+++ includes/file.inc	29 Jun 2007 09:52: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.22
diff -u -r1.22 color.module
--- modules/color/color.module	4 Jun 2007 07:22:17 -0000	1.22
+++ modules/color/color.module	29 Jun 2007 09:52:16 -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)) {
