Ver Fonte

added applicationPath()

ncannasse há 10 anos atrás
pai
commit
8072a79195
1 ficheiros alterados com 14 adições e 0 exclusões
  1. 14 0
      hxd/File.hx

+ 14 - 0
hxd/File.hx

@@ -258,4 +258,18 @@ class File {
 		#end
 	}
 
+	public static function applicationPath() : String {
+		#if flash
+		var path = flash.Lib.current.loaderInfo.loaderURL.substr(7); // file://
+		if( path.charCodeAt(2) == "|".code ) // driver letter on windows
+			path = path.charAt(1) + ":" + path.substr(3);
+		var path = path.split("/");
+		path[path.length - 1] = "";
+		return path.join("/");
+		#else
+		throw "Not supported";
+		return null;
+		#end
+	}
+
 }