Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.51
diff -u -F^f -r1.51 file.inc
--- includes/file.inc	12 Nov 2005 09:23:50 -0000	1.51
+++ includes/file.inc	12 Nov 2005 12:01:16 -0000
@@ -597,4 +597,21 @@ function file_directory_path() {
   return variable_get('file_directory_path', 'files');
 }
 
+/**
+ * Validates the existence of the directory specified in $form_element.
+ * This function is called from the system_view_general form to validate
+ * both the file_directory_path and file_directory_temp directories.
+ * If validation fails, the form element $form_element_name is flagged
+ * with an error from within the file_check_directory function.
+ *
+ * @param $form_element
+ *   The form element containing the directory to be validated.
+ * @param $form_element_name
+ *   The name of the form element, used to flag errors.
+ * @param $key
+ *   The key of the form array where the value to check can be found
+ */
+function file_directory_valid($form_element, $form_element_name, $key = '#value') {
+  return file_check_directory($form_element[$key], FILE_CREATE_DIRECTORY, $form_element_name);
+}
 
Index: modules/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system.module,v
retrieving revision 1.253
diff -u -F^f -r1.253 system.module
--- modules/system.module	12 Nov 2005 11:26:16 -0000	1.253
+++ modules/system.module	12 Nov 2005 12:01:17 -0000
@@ -321,18 +321,33 @@ function system_view_general() {
   file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
 
   $form['files']['file_directory_path'] = array(
-    '#type' => 'textfield', '#title' => t('File system path'), '#default_value' => $directory_path, '#maxlength' => 255, '#valid' => 'directory',
-    '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.')
+    '#type' => 'textfield',
+    '#title' => t('File system path'),
+    '#default_value' => $directory_path,
+    '#maxlength' => 255,
+    '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'),
+    '#valid' => 'file_directory',
+    '#validation_arguments' => array('file_directory_path'),
   );
 
   $directory_temp = file_directory_temp();
   file_check_directory($directory_temp, FILE_CREATE_DIRECTORY, 'file_directory_temp');
 
   $form['files']['file_directory_temp'] = array(
-    '#type' => 'textfield', '#title' => t('Temporary directory'), '#default_value' => $directory_temp, '#maxlength' => 255, '#valid' => 'directory',
-    '#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.')
+    '#type' => 'textfield',
+    '#title' => t('Temporary directory'),
+    '#default_value' => $directory_temp,
+    '#maxlength' => 255,
+    '#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.'),
+    '#valid' => 'file_directory',
+    '#validation_arguments' => array('file_directory_temp'),
   );
 
+  if (!isset($_POST['op'])) {
+    file_directory_valid($form['files']['file_directory_path'], 'file_directory_path', '#default_value');
+    file_directory_valid($form['files']['file_directory_temp'], 'file_directory_temp', '#default_value');
+  }
+
   $form['files']['file_downloads'] = array(
     '#type' => 'radios', '#title' => t('Download method'), '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC),
     '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using http directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')),
