From 65a3ccc8fe15ae6a9df84bc16275d5ea02c17904 Mon Sep 17 00:00:00 2001 From: Karim Akra Date: Sun, 27 Jul 2025 23:50:20 +0300 Subject: [PATCH] add the same changes to the .env parser on project.hxp !! --- project.hxp | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/project.hxp b/project.hxp index 72a951d23..991c77d97 100644 --- a/project.hxp +++ b/project.hxp @@ -1740,17 +1740,42 @@ class Project extends HXProject var env = new Map(); for (line in envFile.split('\n')) { - if (line == "" || line.startsWith("#")) continue; + if (line.length <= 0 || line.startsWith("#") || shouldExcludeKey(line)) continue; - var parts = line.split('='); - if (parts.length != 2) continue; + var index:Int = line.indexOf('='); - env.set(parts[0], parts[1]); + if (index == -1) continue; + + var field:String = line.substr(0, index); + var value:String = line.substr(index + 1); + + env.set(field, value); } return env; } + private static function shouldExcludeEnvKey(key:String):Bool + { + final android:Bool = key.startsWith('ANDROID_'); + final ios:Bool = key.startsWith('IOS_'); + final mobile:Bool = key.startsWith('MOBILE_') || ios || android; + final web:Bool = key.startsWith('WEB_'); + final desktop:Bool = key.startsWith('DESKTOP_'); + + #if html5 + if (mobile || desktop) return true; + #elseif desktop + if (mobile || web) return true; + #elseif android + if (mobile || web || desktop) return true; + #elseif ios + if (android || web || desktop) return true; + #end + + return false; + } + public function readASTCExclusion():Void { astcExcludes = File.getContent('./compression-excludes.txt').trim().split('\n');