add check if mountpoint is mount

This commit is contained in:
Jakobus Schürz 2020-03-22 05:12:09 +01:00
parent 2eb0dbdac2
commit 7cfcef713e

View file

@ -310,7 +310,7 @@ def main(args):
mountpoint = Path(os.path.join(os.environ['HOME'], args.mountpoint)) mountpoint = Path(os.path.join(os.environ['HOME'], args.mountpoint))
if mountpoint.is_symlink(): if mountpoint.is_symlink():
mountpoint.unlink(); mountpoint.unlink();
if mountpoint.exists(): if mountpoint.exists() and not mountpoint.is_mount():
if mountpoint.is_dir(): if mountpoint.is_dir():
if os.listdir(mountpoint): if os.listdir(mountpoint):
mountpoint.rename(str(mountpoint) + "-" + datetime.now().strftime("%Y-%m-%d") mountpoint.rename(str(mountpoint) + "-" + datetime.now().strftime("%Y-%m-%d")