Pārlūkot izejas kodu

bugfix with toplevel file (close #273)

Nicolas Cannasse 8 gadi atpakaļ
vecāks
revīzija
7fab81d6cd
1 mainītis faili ar 9 papildinājumiem un 6 dzēšanām
  1. 9 6
      hxd/fs/LocalFileSystem.hx

+ 9 - 6
hxd/fs/LocalFileSystem.hx

@@ -439,13 +439,16 @@ class LocalFileSystem implements FileSystem {
 			hashes = try haxe.Json.parse(hxd.File.getBytes(tmpDir + "hashes.json").toString()) catch( e : Dynamic ) {};
 		}
 		var root : Dynamic = hashes;
-		for( p in new haxe.io.Path(path).dir.split("/") ) {
-			var f = Reflect.field(root, p);
-			if( f == null ) {
-				f = {};
-				Reflect.setField(root, p, f);
+		var topDir = new haxe.io.Path(path).dir;
+		if( topDir != null ) {
+			for( p in topDir.split("/") ) {
+				var f = Reflect.field(root, p);
+				if( f == null ) {
+					f = {};
+					Reflect.setField(root, p, f);
+				}
+				root = f;
 			}
-			root = f;
 		}
 		var content = hxd.File.getBytes(realFile);
 		var hash = haxe.crypto.Sha1.make(content).toHex();