mach: add is_app option to disable gamemode in desktop applications; use parseIp4 (#544)

* mach: add `is_app` option to disable gamemode in desktop applications
* use parseIp4 instead of resolveIp (which throws a compile error in windows)
This commit is contained in:
Ali Chraghi 2022-09-17 11:02:27 +04:30 committed by GitHub
parent 47d1544b64
commit 6043c7eae6
Failed to generate hash of commit
3 changed files with 48 additions and 45 deletions

View file

@ -371,7 +371,7 @@ pub const App = struct {
if (app.platform == .web) {
const address = std.process.getEnvVarOwned(app.b.allocator, "MACH_ADDRESS") catch app.b.allocator.dupe(u8, "127.0.0.1") catch unreachable;
const port = std.process.getEnvVarOwned(app.b.allocator, "MACH_PORT") catch app.b.allocator.dupe(u8, "8080") catch unreachable;
const address_parsed = std.net.Address.resolveIp(address, std.fmt.parseInt(u16, port, 10) catch unreachable) catch unreachable;
const address_parsed = std.net.Address.parseIp4(address, std.fmt.parseInt(u16, port, 10) catch unreachable) catch unreachable;
const wasmserve = @import("tools/wasmserve/wasmserve.zig");
const install_step_name = if (std.mem.startsWith(u8, app.step.name, "example-"))
app.step.name