At first I was confused by this because we have a test (added in f8ac3c7) which passes on all supported systems (including Windows). But then I realized that the test does not include any nested directories. All paths tested do not include any slashes (for example, favicon.ico is the complete path tested). However, the failing example in squidfunk/mkdocs-material#1282 is using a nested path (assets/images/favicon.png). Therefore, if line 77 is comparing assets/images/favicon.png to assets\images\favicon.png, the comparison will fail and the file will be overwritten. Normally, this is not a problem as MkDocs uses the same methods for creating all of its paths internally, which ensures that they all use the same format. However, in this instance, one of the paths being compared is provided by the Jinja template environment and we cannot assume that that path is normalized in the same manner,
This is my best guess without a way to test it. To make matters worse, our Windows CI tests are broken for reasons I don't understand, so I can't rely on them for testing.
Normalizing the path before checking the files in files.py fixes it:
# Theme files do not override docs_dir filespath=os.path.normpath(path)
# Find the first theme dir which contains path ifos.path.isfile(os.path.join(dir, path)):
self.append(File(path, dir, config['site_dir'], config['use_directory_urls']))
(Line 3 was added.)
Didn't test it on Unix, but should work there as well.