Quote paths in shell commands

This commit is contained in:
Max Howell 2009-05-21 12:40:40 +01:00
parent 358c5c8b8a
commit 1b5d1c16ac
2 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ case ARGV[0]
when 'ln' then when 'ln' then
abort "#{ARGV[1]} is not a directory" unless File.directory? ARGV[1] abort "#{ARGV[1]} is not a directory" unless File.directory? ARGV[1]
#TODO check is under +/ with name AND version #TODO if user specifies just name and not version dir, do latest version
#TODO you should mkdirs as you find them and symlink files otherwise #TODO you should mkdirs as you find them and symlink files otherwise
#TODO consider using hardlinks #TODO consider using hardlinks
@ -28,7 +28,7 @@ case ARGV[0]
to.mkpath unless to.exist? to.mkpath unless to.exist?
elsif from.file? elsif from.file?
tod=to.dirname tod=to.dirname
Dir.chdir(tod) { `ln -s #{from.relative_path_from tod}` } Dir.chdir(tod) { `ln -s "#{from.relative_path_from tod}"` }
end end
end end
@ -43,5 +43,5 @@ case ARGV[0]
end end
else else
puts "usage: #{$0} [prune] [ln path]" puts "usage: #{$0} [prune] [ln path] [install pkg]"
end end