From a47a2e5e8b7854c44f7d47f981c844b6e584bd53 Mon Sep 17 00:00:00 2001 From: Simon Lindholm Date: Mon, 4 Jul 2022 19:27:23 +0200 Subject: [PATCH] Allow building with older GCC --- Makefile | 3 ++- files.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dc25bb9..9baf6a6 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ all: wibo CXXFLAGS = -Wall -g -m32 -std=c++2a -lstdc++ -MD +LDFLAGS = -lstdc++fs BUILD_DIR := build CPP_FILES := $(wildcard *.cpp) @@ -14,7 +15,7 @@ $(BUILD_DIR)/%.o: %.cpp | $(BUILD_DIR) $(CXX) -c $(CXXFLAGS) $< -o $@ wibo: $(O_FILES) - $(CXX) $(CXXFLAGS) $^ -o $@ + $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) clean: $(RM) -r $(BUILD_DIR) wibo diff --git a/files.cpp b/files.cpp index 0a574b9..c52c6d2 100644 --- a/files.cpp +++ b/files.cpp @@ -1,5 +1,6 @@ #include "common.h" #include "files.h" +#include namespace files { static FILE *handleFps[0x10000]; @@ -14,7 +15,7 @@ namespace files { std::replace(str.begin(), str.end(), '\\', '/'); // Remove the drive letter - if (str.starts_with("c:/") || str.starts_with("C:/")) { + if (str.rfind("c:/", 0) == 0 || str.rfind("C:/", 0) == 0) { str.erase(0, 2); }