@@ -151,16 +151,22 @@ def on_config(self, config):
151151if not isinstance (loaded_configs ,list ):
152152loaded_configs = [loaded_configs ]
153153
154+ # It can happen that the drive letter case is inconsistent on Windows.
155+ # Therefore, assure first character to be uppercase for the following
156+ # checks. See: https://t.ly/9t1SU
157+ site_prefixes = list (map (capitalize ,site .PREFIXES ))
158+ cwd = capitalize (os .getcwd ())
159+
154160# We need to make sure the user put every file in the current working
155161# directory. To assure the reproduction inside the ZIP file can be run,
156162# validate that the MkDocs paths are children of the current root.
157- paths_to_validate = [
163+ paths_to_validate = list ( map ( capitalize , [
158164config .config_file_path ,
159165config .docs_dir ,
160166abs_custom_dir ,
161167abs_projects_dir ,
162168* [cfg .get ("INHERIT" ,"" )for cfg in loaded_configs ]
163- ]
169+ ]))
164170
165171# Convert relative hook paths to absolute path
166172for hook in config .hooks :
@@ -169,7 +175,7 @@ def on_config(self, config):
169175
170176# Remove valid paths from the list
171177for path in list (paths_to_validate ):
172- if not path or path .startswith (os . getcwd () ):
178+ if not path or path .startswith (cwd ):
173179paths_to_validate .remove (path )
174180
175181# Report the invalid paths to the user
@@ -191,14 +197,14 @@ def on_config(self, config):
191197self .excluded_entries = []
192198
193199# Exclude the site_dir at project root
194- if config .site_dir .startswith (os . getcwd () ):
200+ if capitalize ( config .site_dir ) .startswith (cwd ):
195201self .exclusion_patterns .append (_resolve_pattern (config .site_dir ))
196202
197203# Exclude the Virtual Environment directory. site.getsitepackages() has
198204# inconsistent results across operating systems, and relies on the
199205# PREFIXES that will contain the absolute path to the activated venv.
200- for path in site . PREFIXES :
201- if path .startswith (os . getcwd () ):
206+ for path in site_prefixes :
207+ if path .startswith (cwd ):
202208self .exclusion_patterns .append (_resolve_pattern (path ))
203209
204210# Guess other Virtual Environment paths in case we forget to activate
@@ -209,9 +215,9 @@ def on_config(self, config):
209215if filename .lower ()!= "pyvenv.cfg" :
210216continue
211217
212- path = abs_root [ 0 ]. upper () + abs_root [ 1 :]
218+ path = capitalize ( abs_root )
213219
214- if path not in site . PREFIXES :
220+ if path not in site_prefixes :
215221print (f"Possible inactive venv:{ path } " )
216222self .exclusion_patterns .append (_resolve_pattern (path ))
217223
@@ -509,7 +515,7 @@ def _load_yaml(abs_src_path: str):
509515# in the pattern creation for files and directories. The patterns are matched
510516# using the search function, so they are prefixed with ^ for specificity.
511517def _resolve_pattern (abspath :str ,return_path :bool = False ):
512- path = abspath .replace (os .getcwd (),"" ,1 )
518+ path = capitalize ( abspath ) .replace (capitalize ( os .getcwd () ),"" ,1 )
513519path = path .replace (os .sep ,"/" ).rstrip ("/" )
514520
515521if not path :
@@ -543,6 +549,11 @@ def _is_dotpath(path: str, log_warning: bool = False) -> bool:
543549return True
544550return False
545551
552+ # It can happen that the drive letter case is inconsistent on Windows.
553+ # Capitalize the first character keeping the rest the same for comparison.
554+ # See: https://t.ly/9t1SU
555+ def capitalize (path :str ):
556+ return path [0 ].upper ()+ path [1 :]if path else path
546557
547558# -----------------------------------------------------------------------------
548559# Data