@@ -954,6 +954,13 @@ def ListDir(dirpath, followlink=False, duplicates=False, include_regex=None, exc
954954 include_pattern = re .compile (include_regex ) if include_regex else None
955955 exclude_pattern = re .compile (exclude_regex ) if exclude_regex else None
956956 for mydirfile in dirpath :
957+ if re .match ("^file://" , mydirfile , re .IGNORECASE ):
958+ # Normalize to file:/// if it's a local path (no host)
959+ if mydirfile .lower ().startswith ("file://" ) and not mydirfile .lower ().startswith ("file:///" ):
960+ # insert the extra slash
961+ mydirfile = "file:///" + mydirfile [7 :]
962+ dparsed = urlparse (mydirfile )
963+ mydirfile = url2pathname (dparsed .path )
957964 if not os .path .exists (mydirfile ):
958965 return False
959966 mydirfile = NormalizeRelativePath (mydirfile )
@@ -1024,6 +1031,13 @@ def ListDirAdvanced(dirpath, followlink=False, duplicates=False, include_regex=N
10241031 include_pattern = re .compile (include_regex ) if include_regex else None
10251032 exclude_pattern = re .compile (exclude_regex ) if exclude_regex else None
10261033 for mydirfile in dirpath :
1034+ if re .match ("^file://" , mydirfile , re .IGNORECASE ):
1035+ # Normalize to file:/// if it's a local path (no host)
1036+ if mydirfile .lower ().startswith ("file://" ) and not mydirfile .lower ().startswith ("file:///" ):
1037+ # insert the extra slash
1038+ mydirfile = "file:///" + mydirfile [7 :]
1039+ dparsed = urlparse (mydirfile )
1040+ mydirfile = url2pathname (dparsed .path )
10271041 if not os .path .exists (mydirfile ):
10281042 return False
10291043 mydirfile = NormalizeRelativePath (mydirfile )
0 commit comments