On my mac I've mapped an SMB share as a Volume. I would like to get the real path of this Volume in my python code.
➜ MYVOLUME pwd
/Volumes/MYVOLUME
➜ MYVOLUME mount
/dev/disk1s1 on / (apfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk1s4 on /private/var/vm (apfs, local, noexec, journaled, noatime, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
//fistname.lastname@10.10.50.20/Projects/SomeProject on /Volumes/MYVOLUME (smbfs, nodev, nosuid, mounted by user)
I would like to get the //fistname.lastname@10.10.50.20/Projects/SomeProject
part. I've tried using below but it doesn't get me the actual SMB location I want.
def find_mount_point(self,path):
path = os.path.abspath(path)
while not os.path.ismount(path):
path = os.path.dirname(path)
return path