diff options
author | tschechniker <tobias@tschech-online.de> | 2012-04-04 13:47:30 +0200 |
---|---|---|
committer | tschechniker <tobias@tschech-online.de> | 2012-04-04 13:47:30 +0200 |
commit | c8175be96157bb97374b1d9bb1be91c7b97bd640 (patch) | |
tree | 121b106217257f7470a0a5973226a30dd102632a /system | |
parent | c8709839a57feb991a1fef527afecd1b07f12f0f (diff) |
Added Windows path compatibility to function read_dir
Diffstat (limited to 'system')
-rw-r--r-- | system/libraries/Zip.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index e91e2a2ff..2ec7befd3 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -279,7 +279,7 @@ class CI_Zip { */ public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) { - $path = rtrim($path, '/\\').'/'; + $path = rtrim($path, '/\\').DIRECTORY_SEPARATOR; if ( ! $fp = @opendir($path)) { return FALSE; @@ -288,7 +288,7 @@ class CI_Zip { // Set the original directory root for child dir's to use as relative if ($root_path === NULL) { - $root_path = dirname($path).'/'; + $root_path = dirname($path).DIRECTORY_SEPARATOR; } while (FALSE !== ($file = readdir($fp))) @@ -300,11 +300,12 @@ class CI_Zip { if (@is_dir($path.$file)) { - $this->read_dir($path.$file.'/', $preserve_filepath, $root_path); + $this->read_dir($path.$file.DIRECTORY_SEPARATOR, $preserve_filepath, $root_path); } elseif (FALSE !== ($data = file_get_contents($path.$file))) { - $name = str_replace('\\', '/', $path); + $name = str_replace("\\", DIRECTORY_SEPARATOR, $path); + $name = str_replace("/", DIRECTORY_SEPARATOR, $path); if ($preserve_filepath === FALSE) { $name = str_replace($root_path, '', $name); |