Browse Source

php: FileSystem.readDirectory now skips '.' and '..' to be consistent with neko (issue 226)

Franco Ponticelli 15 years ago
parent
commit
c64343f5f8
2 changed files with 2 additions and 1 deletions
  1. 1 0
      doc/CHANGES.txt
  2. 1 1
      std/php/FileSystem.hx

+ 1 - 0
doc/CHANGES.txt

@@ -10,6 +10,7 @@
 	neko : Std.parseFloat now returns NaN with invalid string
 	php: fixed Array.push must return the current length (issue 219)
 	php: fixed EReg.replace (issue 194)
+	php: FileSystem.readDirectory now skips '.' and '..' to be consistent with neko (issue 226)
 
 2010-08-14: 2.06
 	neko : change serializer to be able to handle instances of basic classes from other modules

+ 1 - 1
std/php/FileSystem.hx

@@ -105,7 +105,7 @@ class FileSystem {
 	public static function readDirectory( path : String ) : Array<String> {
 		var l = untyped __call__("array");
 		untyped __php__('$dh = opendir($path);
-        while (($file = readdir($dh)) !== false) $l[] = $file;
+        while (($file = readdir($dh)) !== false) if("." != $file && ".." != $file) $l[] = $file;
         closedir($dh);');
 		return untyped __call__("new _hx_array", l);
 	}