@@ -591,6 +591,8 @@ def ListDir(dirpath, followlink=False, duplicates=False, include_regex=None, exc
591591 Returns:
592592 list: A list of files and directories matching the criteria.
593593 """
594+ if os .stat not in os .supports_follow_symlinks and followlink :
595+ followlink = False
594596 if isinstance (dirpath , (list , tuple )):
595597 dirpath = list (filter (None , dirpath ))
596598 elif isinstance (dirpath , basestring ):
@@ -656,6 +658,8 @@ def ListDirAdvanced(dirpath, followlink=False, duplicates=False, include_regex=N
656658 Returns:
657659 list: A list of files and directories matching the criteria.
658660 """
661+ if os .stat not in os .supports_follow_symlinks and followlink :
662+ followlink = False
659663 if isinstance (dirpath , (list , tuple )):
660664 dirpath = list (filter (None , dirpath ))
661665 elif isinstance (dirpath , basestring ):
@@ -2611,6 +2615,8 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
26112615 infilelist = list (filter (None , infiles ))
26122616 elif (isinstance (infiles , (basestring , ))):
26132617 infilelist = list (filter (None , [infiles ]))
2618+ if os .stat not in os .supports_follow_symlinks and followlink :
2619+ followlink = False
26142620 if (advancedlist ):
26152621 GetDirList = ListDirAdvanced (infilelist , followlink , False )
26162622 else :
@@ -3796,6 +3802,8 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
37963802 infilelist = list (filter (None , infiles ))
37973803 elif (isinstance (infiles , (basestring , ))):
37983804 infilelist = list (filter (None , [infiles ]))
3805+ if os .stat not in os .supports_follow_symlinks and followlink :
3806+ followlink = False
37993807 if (advancedlist ):
38003808 GetDirList = ListDirAdvanced (infilelist , followlink , False )
38013809 else :
@@ -6482,6 +6490,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, followlink=False, listonly=
64826490 infilelist = list (filter (None , infiles ))
64836491 elif (isinstance (infiles , (basestring , ))):
64846492 infilelist = list (filter (None , [infiles ]))
6493+ if os .stat not in os .supports_follow_symlinks and followlink :
6494+ followlink = False
64856495 if (advancedlist ):
64866496 GetDirList = ListDirAdvanced (infilelist , followlink , False )
64876497 else :
0 commit comments