浏览代码

[php][windows] fixed failure with trailing slash in output dir (#6212)

Aleksandr Kuzmenko 4 年之前
父节点
当前提交
0a9bc9b925
共有 2 个文件被更改,包括 5 次插入4 次删除
  1. 1 0
      extra/CHANGES.txt
  2. 4 4
      src/generators/genphp7.ml

+ 1 - 0
extra/CHANGES.txt

@@ -13,6 +13,7 @@
 	all : fixed inlining of `haxe.DynamicAccess.keyValueIterator` (#10118)
 	analyzer : fixed side effect handling for enums (#10032)
 	cpp : fixed handling of `cpp.ConstCharStar` with analyzer enabled (#9733)
+	php : fixed failure with trailing slash in output dir (#6212)
 
 2021-02-09 4.2.0:
 

+ 4 - 4
src/generators/genphp7.ml

@@ -502,16 +502,16 @@ let rec sure_extends_extern (target:Type.t) =
 *)
 let create_dir_recursive (path:string list) =
 	let rec create dir nested_dirs =
+		let dir = Path.remove_trailing_slash dir in
 		if not (Sys.file_exists dir) then (Unix.mkdir dir 0o755);
 		match nested_dirs with
-			| [] -> ();
+			| [] -> dir
 			| next :: rest -> create (dir ^ "/" ^ next) rest
 	in
 	match path with
 		| [] -> "";
 		| root :: rest ->
-			create root rest;
-			(String.concat "/" path)
+			create root rest
 
 (**
 	@return String representation of specified type path. E.g. returns "\example\Test" for (["example"], "Test")
@@ -3933,7 +3933,7 @@ class class_builder ctx (cls:tclass) =
 class generator (ctx:php_generator_context) =
 	object (self)
 		val mutable build_dir = ""
-		val root_dir = ctx.pgc_common.file
+		val root_dir = Path.remove_trailing_slash ctx.pgc_common.file
 		val mutable init_types = []
 		val mutable boot : (type_builder * string) option  = None
 		val mutable polyfills_source_path : string option = None