From d5d00ef9c09e50433520c7f6687fe3036e3d1124 Mon Sep 17 00:00:00 2001 From: Mo Hyun Date: Wed, 23 Oct 2024 12:12:33 -0700 Subject: [PATCH] Fix pivot path on Windows This was causing a compare of template files to remove the existing dotfiles at the destinations. --- dotdrop/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dotdrop/utils.py b/dotdrop/utils.py index b34d4e9e..6df61e3c 100644 --- a/dotdrop/utils.py +++ b/dotdrop/utils.py @@ -654,7 +654,10 @@ def pivot_path(path, newdir, striphome=False, logger=None): logger.dbg(f'strip home: {striphome}') if striphome: path = strip_home(path) - sub = path.lstrip(os.sep) + + # Account for Windows paths + sub = path.lstrip(PurePath(path).anchor) + new = os.path.join(newdir, sub) if logger: logger.dbg(f'pivot \"{path}\" to \"{new}\"')