Browse Source

[php] fixed `haxe.Resource` with `-D php-prefix=pack.sub`

Alexander Kuzmenko 6 years ago
parent
commit
04eaba23f9
2 changed files with 11 additions and 10 deletions
  1. 1 1
      std/php/_std/haxe/Resource.hx
  2. 10 9
      tests/runci/targets/Php.hx

+ 1 - 1
std/php/_std/haxe/Resource.hx

@@ -36,7 +36,7 @@ class Resource {
 		var pathToRoot = '/../..';
 		var pathToRoot = '/../..';
 		#if php_prefix
 		#if php_prefix
 			pathToRoot += '/..';
 			pathToRoot += '/..';
-			for(i in 0...Global.substr_count(Boot.getPrefix(), '.')) {
+			for(i in 0...Global.substr_count(Boot.getPrefix(), '\\')) {
 				pathToRoot += '/..';
 				pathToRoot += '/..';
 			}
 			}
 		#end
 		#end

+ 10 - 9
tests/runci/targets/Php.hx

@@ -33,16 +33,17 @@ class Php {
 
 
 		var binDir = "bin/php";
 		var binDir = "bin/php";
 
 
-		runCommand("haxe", ["compile-php.hxml"].concat(args));
-		runCommand("php", [binDir + "/index.php"]);
+		for(prefix in [[], ['-D', 'php-prefix=haxe'], ['-D', 'php-prefix=my.pack']]) {
+			changeDirectory(unitDir);
+			deleteDirectoryRecursively(binDir);
 
 
-		deleteDirectoryRecursively(binDir);
+			runCommand("haxe", ["compile-php.hxml"].concat(prefix).concat(args));
+			runCommand("php", [binDir + "/index.php"]);
 
 
-		runCommand("haxe", ["compile-php.hxml", "-D", "php-prefix=haxe"].concat(args));
-		runCommand("php", [binDir + "/index.php"]);
-
-		changeDirectory(sysDir);
-		runCommand("haxe", ["compile-php.hxml"]);
-		runCommand("php", ["bin/php/Main/index.php"]);
+			changeDirectory(sysDir);
+			deleteDirectoryRecursively(binDir);
+			runCommand("haxe", ["compile-php.hxml"].concat(prefix));
+			runCommand("php", ["bin/php/Main/index.php"]);
+		}
 	}
 	}
 }
 }