Fix conflict resolution when destination is a plain file (not a symlink).

This commit is contained in:
Joshua Nichols
2010-03-31 23:18:38 -04:00
parent 5db3048e71
commit cde7989e85
2 changed files with 7 additions and 1 deletions

View File

@@ -31,6 +31,12 @@ class Homesick
system "ln -sf #{source} #{destination}" unless options[:pretend]
end
end
elsif destination.exist?
say_status :conflict, "#{destination} exists", :red unless options[:quiet]
if shell.file_collision(destination) { source }
system "ln -sf #{source} #{destination}" unless options[:pretend]
end
else
say_status :symlink, "#{source.expand_path} to #{destination.expand_path}", :green unless options[:quiet]
system "ln -s #{source} #{destination}" unless options[:pretend]