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');