diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 5 | ||||
-rw-r--r-- | source/blender/blenlib/tests/BLI_path_util_test.cc | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 4fc59e6cffd..4405f25bf2a 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1951,6 +1951,11 @@ bool BLI_path_contains(const char *container_path, const char *containee_path) BLI_path_normalize(NULL, container_native); BLI_path_normalize(NULL, containee_native); +#ifdef WIN32 + BLI_str_tolower_ascii(container_native, PATH_MAX); + BLI_str_tolower_ascii(containee_native, PATH_MAX); +#endif + if (STREQ(container_native, containee_native)) { /* The paths are equal, they contain each other. */ return true; diff --git a/source/blender/blenlib/tests/BLI_path_util_test.cc b/source/blender/blenlib/tests/BLI_path_util_test.cc index fde28ebaf55..65b02a19960 100644 --- a/source/blender/blenlib/tests/BLI_path_util_test.cc +++ b/source/blender/blenlib/tests/BLI_path_util_test.cc @@ -678,3 +678,11 @@ TEST(path_util, PathContains) EXPECT_FALSE(BLI_path_contains("/some/path", "./contents")) << "Relative paths are not supported"; } + +#ifdef WIN32 +TEST(path_util, PathContains_Windows_case_insensitive) +{ + EXPECT_TRUE(BLI_path_contains("C:\\some\\path", "c:\\SOME\\path\\inside")) + << "On Windows path comparison should ignore case"; +} +#endif |