mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +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()
|
UNEXPECTED_SYMLINK = auto()
|
||||||
CONTENT_DIFFERS = auto()
|
CONTENT_DIFFERS = auto()
|
||||||
SYMLINK_DIFFERS = auto()
|
SYMLINK_DIFFERS = auto()
|
||||||
|
UNEXPECTED_DIRECTORY = auto()
|
||||||
|
|
||||||
|
|
||||||
class FileDiff(NamedTuple):
|
class FileDiff(NamedTuple):
|
||||||
|
@ -90,6 +91,9 @@ def compare_files(dot_file: Path, sys_file: Path) -> DiffStatus:
|
||||||
elif sys_file.is_symlink():
|
elif sys_file.is_symlink():
|
||||||
return DiffStatus.UNEXPECTED_SYMLINK
|
return DiffStatus.UNEXPECTED_SYMLINK
|
||||||
|
|
||||||
|
if sys_file.is_dir():
|
||||||
|
return DiffStatus.UNEXPECTED_DIRECTORY
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if file_sum(dot_file) == file_sum(sys_file):
|
if file_sum(dot_file) == file_sum(sys_file):
|
||||||
return DiffStatus.MATCH
|
return DiffStatus.MATCH
|
||||||
|
|
Loading…
Reference in a new issue