Convert to Path objects before checking same-drive req.

Otherwise, passing "." fails. Oops.
This commit is contained in:
voussoir 2020-01-28 19:34:33 -08:00
parent 6d17ed725f
commit f1ddb0817e

View file

@ -3,6 +3,7 @@ import os
import send2trash import send2trash
import sys import sys
from voussoirkit import pathclass
from voussoirkit import spinal from voussoirkit import spinal
def hash_file(file): def hash_file(file):
@ -16,8 +17,9 @@ def hash_file(file):
return hasher.hexdigest() return hasher.hexdigest()
def main(argv): def main(argv):
folders = argv folders = [pathclass.Path(p) for p in argv]
drives = set(os.path.splitdrive(folder)[0] for folder in folders)
drives = set(os.path.splitdrive(folder.absolute_path)[0] for folder in folders)
if len(drives) != 1: if len(drives) != 1:
raise ValueError('All paths must be on the same drive.') raise ValueError('All paths must be on the same drive.')