Prechádzať zdrojové kódy

fixed programPath returns null for 3.4 macro mode (close #279)

Nicolas Cannnasse 8 rokov pred
rodič
commit
e0c079aa8d
1 zmenil súbory, kde vykonal 4 pridanie a 3 odobranie
  1. 4 3
      hxd/fs/LocalFileSystem.hx

+ 4 - 3
hxd/fs/LocalFileSystem.hx

@@ -315,12 +315,13 @@ class LocalFileSystem implements FileSystem {
 		root = new LocalEntry(this, "root", null, froot);
 		#else
 		#if (haxe_ver >= 3.3)
-		var exePath = Sys.programPath().split("\\").join("/").split("/");
+		var pr = Sys.programPath();
+		var exePath = pr == null ? null : pr.split("\\").join("/").split("/");
 		#else
 		var exePath = Sys.executablePath().split("\\").join("/").split("/");
 		#end
-		exePath.pop();
-		var froot = sys.FileSystem.fullPath(exePath.join("/") + "/" + baseDir);
+		if( exePath != null ) exePath.pop();
+		var froot = exePath == null ? baseDir : sys.FileSystem.fullPath(exePath.join("/") + "/" + baseDir);
 		if( froot == null || !sys.FileSystem.isDirectory(froot) ) {
 			froot = sys.FileSystem.fullPath(baseDir);
 			if( froot == null || !sys.FileSystem.isDirectory(froot) )