mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-25 20:54:34 +00:00
Handle sys file being a directory while dotfile is file
This commit is contained in:
parent
a3e01caebf
commit
8536bfa688
4
sync.py
4
sync.py
|
@ -28,6 +28,7 @@ class DiffStatus(Enum):
|
|||
UNEXPECTED_SYMLINK = auto()
|
||||
CONTENT_DIFFERS = auto()
|
||||
SYMLINK_DIFFERS = auto()
|
||||
UNEXPECTED_DIRECTORY = auto()
|
||||
|
||||
|
||||
class FileDiff(NamedTuple):
|
||||
|
@ -90,6 +91,9 @@ def compare_files(dot_file: Path, sys_file: Path) -> DiffStatus:
|
|||
elif sys_file.is_symlink():
|
||||
return DiffStatus.UNEXPECTED_SYMLINK
|
||||
|
||||
if sys_file.is_dir():
|
||||
return DiffStatus.UNEXPECTED_DIRECTORY
|
||||
|
||||
try:
|
||||
if file_sum(dot_file) == file_sum(sys_file):
|
||||
return DiffStatus.MATCH
|
||||
|
|
Loading…
Reference in a new issue