diff --git a/src/asm/output.cpp b/src/asm/output.cpp index 70a251c29..b0a4e040f 100644 --- a/src/asm/output.cpp +++ b/src/asm/output.cpp @@ -492,7 +492,7 @@ static bool dumpMacros(FILE *file) { void out_WriteState(std::string name, std::vector const &features) { FILE *file; if (name != "-") { - file = fopen(name.c_str(), "w"); + file = fopen(name.c_str(), "wb"); } else { name = ""; file = fdopen(STDOUT_FILENO, "w"); diff --git a/test/asm/test.sh b/test/asm/test.sh index c175ebdec..2209fe7cf 100755 --- a/test/asm/test.sh +++ b/test/asm/test.sh @@ -5,11 +5,23 @@ export LC_ALL=C # Game Boy release date, 1989-04-21T12:34:56Z (for reproducible test results) export SOURCE_DATE_EPOCH=609165296 -o="$(mktemp)" -gb="$(mktemp)" -input="$(mktemp)" -output="$(mktemp)" -errput="$(mktemp)" +# On Windows, the paths returned by `mktemp` are Unix paths, whereas RGBDS expects Windows paths. +# Bash implicitly translates them when recognised, but this breaks if the path is prefixed +# (at-files, state file spec, etc.); thus, return an absolute path instead. +set -x + unix_path=$(mktemp) + realpath "$unix_path" + echo "$unix_path" + printf '%s\n' "$unix_path" + echo.exe "$unix_path" + cygpath "$unix_path" +set +x + +o="$(make_temp_file)" +gb="$(make_temp_file)" +input="$(make_temp_file)" +output="$(make_temp_file)" +errput="$(make_temp_file)" # Immediate expansion is the desired behavior. # shellcheck disable=SC2064