From 7b5d40245444e0818c3d1b4e565fefd5f7273715 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Fri, 11 Nov 2016 18:51:38 +0100 Subject: [PATCH] Remove \r line endings before checksumming lua files, to sidestep issues when Windows git autoconverted line endings --- src/stratagus/script.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/stratagus/script.cpp b/src/stratagus/script.cpp index 4a8fa7ccc..f005200a5 100644 --- a/src/stratagus/script.cpp +++ b/src/stratagus/script.cpp @@ -218,6 +218,8 @@ int LuaLoadFile(const std::string &file, const std::string &strArg) return -1; } if (file.rfind("stratagus.lua") != -1 && file.find("scripts/") != -1) { + // First, remove '\r' characters from the input. These are added, for example, by Windows Git, and should be ignored + content.erase(std::remove(content.begin(), content.end(), '\r'), content.end()); FileChecksums ^= fletcher32(content); } const int status = luaL_loadbuffer(Lua, content.c_str(), content.size(), file.c_str());