diff --git a/core/lib/Drupal/Core/Config/InstallStorage.php b/core/lib/Drupal/Core/Config/InstallStorage.php
index 872f0afcfa7b949c7d04a5eb25e19b49a16550d9..6a97b310884fbdccb6c3a066a9d479fe1d5742b9 100644
--- a/core/lib/Drupal/Core/Config/InstallStorage.php
+++ b/core/lib/Drupal/Core/Config/InstallStorage.php
@@ -166,6 +166,11 @@ protected function getAllFolders() {
       if ($profile = drupal_get_profile()) {
         $profile_list = $listing->scan('profile');
         if (isset($profile_list[$profile])) {
+          // Prime the drupal_get_filename() static cache with the profile info
+          // file location so we can use drupal_get_path() on the active profile
+          // during the module scan.
+          // @todo Remove as part of https://www.drupal.org/node/2186491
+          drupal_get_filename('profile', $profile, $profile_list[$profile]->getPathname());
           $this->folders += $this->getComponentNames(array($profile_list[$profile]));
         }
       }