summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2011-08-27 10:07:09 -0400
committerGravatar Jon Bernard <jbernard@tuxion.com> 2011-08-27 10:07:09 -0400
commit28f63469af2fc00d62a866ce08abf4677de315aa (patch)
tree4447498387b658670fa39164e1f67e661da82080
parentcab7b3de36df0b02c60ba7ed35f7b163106f3bb8 (diff)
downloaddotfiles-28f63469af2fc00d62a866ce08abf4677de315aa.tar.gz
dotfiles-28f63469af2fc00d62a866ce08abf4677de315aa.tar.bz2
dotfiles-28f63469af2fc00d62a866ce08abf4677de315aa.zip
Fix forced sync when the dotfile is a directory
I installed the lastpass chrome extension which stores a socket in ~/.lastpass. So I added that directory as an external to /tmp and attempted a forced sync. An error occurred because sync() calls os.remove() as it mistakenly assumes the dotfile is a file and not a directory.
-rw-r--r--dotfiles/core.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/dotfiles/core.py b/dotfiles/core.py
index a1ee264..a288f69 100644
--- a/dotfiles/core.py
+++ b/dotfiles/core.py
@@ -38,7 +38,10 @@ class Dotfile(object):
if not force:
print "Skipping \"%s\", use --force to override" % self.basename
return
- os.remove(self.name)
+ if os.path.isdir(self.name):
+ shutil.rmtree(self.name)
+ else:
+ os.remove(self.name)
os.symlink(self.target, self.name)
def add(self):