Просмотр исходного кода

allow single quotes around paths in hxml files (closes #6780)

Aleksandr Kuzmenko 6 лет назад
Родитель
Сommit
43b8d99453

+ 6 - 1
src/compiler/displayOutput.ml

@@ -601,7 +601,12 @@ exception Completion of string
 
 let unquote v =
 	let len = String.length v in
-	if len > 0 && v.[0] = '"' && v.[len - 1] = '"' then String.sub v 1 (len - 2) else v
+	if len > 0 then
+		match v.[0], v.[len - 1] with
+			| '"', '"'
+			| '\'', '\'' -> String.sub v 1 (len - 2)
+			| _ -> v
+	else v
 
 let handle_display_argument com file_pos pre_compilation did_something =
 	match file_pos with

+ 6 - 0
tests/misc/projects/Issue6780/Main.hx

@@ -0,0 +1,6 @@
+class Main {
+	public static function main() {
+		trace(Single);
+		trace(Double);
+	}
+}

+ 3 - 0
tests/misc/projects/Issue6780/compile.hxml

@@ -0,0 +1,3 @@
+-cp 'single quotes'
+-cp "double quotes"
+-main Main

+ 1 - 0
tests/misc/projects/Issue6780/double quotes/Double.hx

@@ -0,0 +1 @@
+class Double {}

+ 1 - 0
tests/misc/projects/Issue6780/single quotes/Single.hx

@@ -0,0 +1 @@
+class Single {}