From 0f90b6fa0f8849dab036332ba0c554ffdf900557 Mon Sep 17 00:00:00 2001 From: Richard Knight Date: Wed, 28 Oct 2020 22:07:20 +0000 Subject: [PATCH] Allow both direction of slash as a path separator for initial path on Windows --- fast_obj.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fast_obj.h b/fast_obj.h index b0db70f..69edefd 100644 --- a/fast_obj.h +++ b/fast_obj.h @@ -1338,6 +1338,11 @@ fastObjMesh* fast_obj_read(const char* path) /* Find base path for materials/textures */ if (string_find_last(path, FAST_OBJ_SEPARATOR, &sep)) data.base = string_substr(path, 0, sep + 1); +#ifdef _WIN32 + /* Check for the other direction slash on windows too, but not linux/mac where it's a valid char */ + else if (string_find_last(path, FAST_OBJ_OTHER_SEP, &sep)) + data.base = string_substr(path, 0, sep + 1); +#endif /* Create buffer for reading file */