Index: install.php
===================================================================
RCS file: /cvs/drupal/drupal/install.php,v
retrieving revision 1.163
diff -u -p -r1.163 install.php
--- install.php	4 Apr 2009 00:35:45 -0000	1.163
+++ install.php	20 Apr 2009 22:59:12 -0000
@@ -103,7 +103,8 @@ function install_main() {
   }
 
   // Load the profile.
-  require_once DRUPAL_ROOT . "/profiles/$profile/$profile.profile";
+  $profile_file = drupal_get_profile_filepath($profile);
+  require_once $profile_file;
 
   // Locale selection
   if (!empty($_GET['locale'])) {
@@ -401,13 +402,6 @@ function install_settings_form_submit($f
 }
 
 /**
- * Find all .profile files.
- */
-function install_find_profiles() {
-  return file_scan_directory('./profiles', '/\.profile$/', array('key' => 'name'));
-}
-
-/**
  * Allow admin to select which profile to install.
  *
  * @return
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.876
diff -u -p -r1.876 common.inc
--- includes/common.inc	15 Apr 2009 23:49:06 -0000	1.876
+++ includes/common.inc	20 Apr 2009 22:59:13 -0000
@@ -3181,8 +3181,9 @@ function drupal_system_listing($mask, $d
   // themes as organized by a distribution. It is pristine in the same way
   // that /modules is pristine for core; users should avoid changing anything
   // there in favor of sites/all or sites/<domain> directories.
-  if (file_exists("profiles/$profile/$directory")) {
-    $searchdir[] = "profiles/$profile/$directory";
+  $profile_dir = dirname(drupal_get_profile_filepath($profile));
+  if (file_exists($profile_dir)) {
+    $searchdir[] = $profile_dir;
   }
 
   if (file_exists("$config/$directory")) {
@@ -4301,3 +4302,21 @@ function _drupal_flush_css_js() {
   }
   variable_set('css_js_query_string', $new_character . substr($string_history, 0, 19));
 }
+
+/**
+ * Get the profile directory.
+ */
+function drupal_get_profile_filepath($profile) {
+  static $profiles;
+
+  if (!isset($profiles)) {
+    require_once DRUPAL_ROOT .'/includes/install.inc';
+    $profiles = install_find_profiles();
+  }
+
+  if (!isset($profiles[$profile]) || empty($profiles[$profile]->filepath)) {
+    return FALSE;
+  }
+
+  return DRUPAL_ROOT .'/'. $profiles[$profile]->filepath;
+}
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.87
diff -u -p -r1.87 install.inc
--- includes/install.inc	2 Apr 2009 20:39:44 -0000	1.87
+++ includes/install.inc	20 Apr 2009 22:59:13 -0000
@@ -430,7 +430,7 @@ function drupal_get_install_files($modul
  *   The list of modules to install.
  */
 function drupal_get_profile_modules($profile, $locale = 'en') {
-  $profile_file = "./profiles/$profile/$profile.profile";
+  $profile_file = drupal_get_profile_filepath($profile);
   require_once($profile_file);
 
   // Get a list of modules required by this profile.
@@ -452,7 +452,7 @@ function drupal_verify_profile($profile,
   include_once DRUPAL_ROOT . '/includes/file.inc';
   include_once DRUPAL_ROOT . '/includes/common.inc';
 
-  $profile_file = DRUPAL_ROOT . "/profiles/$profile/$profile.profile";
+  $profile_file = drupal_get_profile_filepath($profile);
 
   if (!isset($profile) || !file_exists($profile_file)) {
     install_no_profile_error();
@@ -917,7 +917,7 @@ function st($string, $args = array()) {
 function drupal_check_profile($profile) {
   include_once DRUPAL_ROOT . '/includes/file.inc';
 
-  $profile_file = DRUPAL_ROOT . "/profiles/$profile/$profile.profile";
+  $profile_file = drupal_get_profile_filepath($profile);
 
   if (!isset($profile) || !file_exists($profile_file)) {
     install_no_profile_error();
@@ -1053,3 +1053,11 @@ function install_check_requirements($pro
   }
   return $requirements;
 }
+
+/**
+ * Find all .profile files.
+ */
+function install_find_profiles() {
+  return file_scan_directory('./profiles', '/\.profile$/', array('key' => 'name'));
+}
+
