 core/includes/file.inc                                       |    9 +++++----
 .../system/lib/Drupal/system/Tests/File/DirectoryTest.php    |   10 +++++-----
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/core/includes/file.inc b/core/includes/file.inc
index 534d211..fc4e2d0 100644
--- a/core/includes/file.inc
+++ b/core/includes/file.inc
@@ -1746,10 +1746,11 @@ function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) {
   // If recursive, create each missing component of the parent directory
   // individually and set the mode explicitly to override the umask.
   if ($recursive) {
-    // Ensure the path is using DIRECTORY_SEPARATOR.
-    $uri = str_replace('/', DIRECTORY_SEPARATOR, $uri);
+    // Ensure the path is using all forward slashes so it can be exploded.
+    $uri = str_replace('\\', '/', $uri);
     // Determine the components of the path.
-    $components = explode(DIRECTORY_SEPARATOR, $uri);
+    $components = explode('/', $uri);
+    // Don't handle the top-level directory in this loop.
     array_pop($components);
     $recursive_path = '';
     foreach ($components as $component) {
@@ -1765,7 +1766,7 @@ function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) {
         }
       }
 
-      $recursive_path .= DIRECTORY_SEPARATOR;
+      $recursive_path .= '/';
     }
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php
index 9a7a812..c3cb7ac 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php
@@ -23,7 +23,7 @@ public static function getInfo() {
    * Test local directory handling functions.
    */
   function testFileCheckLocalDirectoryHandling() {
-    $directory = conf_path() . '/files';
+    $directory = 'public://';
 
     // Check a new recursively created local directory for correct file system
     // permissions.
@@ -31,18 +31,18 @@ function testFileCheckLocalDirectoryHandling() {
     $child = $this->randomName();
 
     // Files directory already exists.
-    $this->assertTrue(is_dir($directory), t('Files directory already exists.'), 'File');
+    $this->assertTrue(is_dir($directory), 'Files directory already exists.', 'File');
     // Make files directory writable only.
     $old_mode = fileperms($directory);
 
     // Create the directories.
     $parent_path = $directory . DIRECTORY_SEPARATOR . $parent;
     $child_path = $parent_path . DIRECTORY_SEPARATOR . $child;
-    $this->assertTrue(drupal_mkdir($child_path, 0775, TRUE), t('No error reported when creating new local directories.'), 'File');
+    $this->assertTrue(drupal_mkdir($child_path, 0775, TRUE), 'No error reported when creating new local directories.', 'File');
 
     // Ensure new directories also exist.
-    $this->assertTrue(is_dir($parent_path), t('New parent directory actually exists.'), 'File');
-    $this->assertTrue(is_dir($child_path), t('New child directory actually exists.'), 'File');
+    $this->assertTrue(is_dir($parent_path), 'New parent directory actually exists.', 'File');
+    $this->assertTrue(is_dir($child_path), 'New child directory actually exists.', 'File');
 
     // Check that new directory permissions were set properly.
     $this->assertDirectoryPermissions($parent_path, 0775);
