Fix http-server on Windows

This commit is contained in:
Joshua Granick
2015-03-23 16:31:02 -07:00
parent 12528a53bc
commit 54d8d5eee3
2 changed files with 23 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ class ProjectXMLParser extends HXProject {
public var includePaths:Array <String>;
private static var varMatch = new EReg("\\${(.*?)}", "");
private static var varMatch = new EReg ("\\${(.*?)}", "");
public function new (path:String = "", defines:Map <String, Dynamic> = null, includePaths:Array <String> = null, useExtensionPath:Bool = false) {
@@ -97,7 +97,7 @@ class ProjectXMLParser extends HXProject {
defines.set ("html5", "1");
} else if (targetFlags.exists ("cpp") || ((platformType != PlatformType.WEB) && !targetFlags.exists("html5")) || target == Platform.EMSCRIPTEN) {
} else if (targetFlags.exists ("cpp") || ((platformType != PlatformType.WEB) && !targetFlags.exists ("html5")) || target == Platform.EMSCRIPTEN) {
defines.set ("native", "1");
defines.set ("cpp", "1");
@@ -1157,17 +1157,25 @@ class ProjectXMLParser extends HXProject {
case "haxedef":
var name = substitute (element.att.name);
var value = "";
if (element.has.remove) {
if (element.has.value) {
haxedefs.remove (substitute (element.att.remove));
value = substitute (element.att.value);
} else {
var name = substitute (element.att.name);
var value = "";
if (element.has.value) {
value = substitute (element.att.value);
}
haxedefs.set (name, value);
}
haxedefs.set (name, value);
case "haxeflag", "compilerflag":
var flag = substitute (element.att.name);

View File

@@ -81,16 +81,19 @@ function listen(port) {
var server = httpServer.createServer(options);
server.listen(port, host, function() {
var uri = [ssl ? 'https' : 'http', '://', host, ':', port].join('');
var protocol = ssl ? 'https:' : 'http:';
var canonical_host = host === "0.0.0.0" ? "localhost" : host;
var uri = protocol + '//' + host + ':' + port;
var canonical_uri = protocol + '//' + canonical_host + ':' + port;
log('Starting up http-server, serving '.yellow
+ server.root.cyan
+ ((ssl) ? ' through'.yellow + ' https'.cyan : '')
+ (ssl ? ' through'.yellow + ' https'.cyan : '')
+ ' on: '.yellow
+ uri.cyan);
log('Hit CTRL-C to stop the server');
if (argv.o) {
opener(uri);
opener(canonical_uri);
}
});
}