From 0b18d27042b37429a3f82fd546500411fe1360c2 Mon Sep 17 00:00:00 2001 From: Hill Ma Date: Sun, 28 Jun 2020 15:58:20 -0700 Subject: [PATCH] Use strrchr() when finding the '.' that begins the file extension. Sometimes we encounter file paths like ../foo/bar.obj; searching from the end of the string would yield the correct result. --- samples/SimpleOpenGL/Sample_SimpleOpenGL.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/SimpleOpenGL/Sample_SimpleOpenGL.c b/samples/SimpleOpenGL/Sample_SimpleOpenGL.c index bcc964efe..01704a1e4 100644 --- a/samples/SimpleOpenGL/Sample_SimpleOpenGL.c +++ b/samples/SimpleOpenGL/Sample_SimpleOpenGL.c @@ -376,7 +376,7 @@ int main(int argc, char **argv) // Check and validate the specified model file extension. model_file = argv[1]; - const char* extension = strchr(model_file, '.'); + const char* extension = strrchr(model_file, '.'); if (!extension) { print_error("Please provide a file with a valid extension."); return EXIT_FAILURE;