On 11/7/22, Charles Machalow <csm10...@gmail.com> wrote: > So would you be for specific methods to check if a given path is a > junction?
I'd prefer for ismount() to be modified to always return true for a junction. This would be a significant rewrite of the current implementation, which is only true for a junction that targets a system volume mount point (i.e. "\\?\Volume{GUID}\"). Of course ismount() wouldn't be true for only junctions. It's also be true for the root path of any drive, device, or UNC share if it's an existing filesystem directory. Implementing a function that checks for only a junction is simple enough. For example: def isjunction(path): """Test whether a path is a junction. """ try: st = os.lstat(path) except (OSError, ValueError, AttributeError): return False return bool(st.st_reparse_tag & stat.IO_REPARSE_TAG_MOUNT_POINT) To be completely certain, sometimes st_file_attributes is also checked for stat.FILE_ATTRIBUTE_REPARSE_POINT. But a filesystem that sets a reparse point on a directory without also setting the latter file attribute would be dysfunctional. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/SE6ZHNRQ44D72ZPVCGTLNFSKVX5SAGXP/ Code of Conduct: http://python.org/psf/codeofconduct/