Changeset 4544 for dotfiles

Show
Ignore:
Timestamp:
01/13/08 17:31:39 (5 years ago)
Author:
cho45
Message:

dotfiles/setup/cho45-setup.rb:

できるだけエラーがでないように修正

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dotfiles/setup/cho45-setup.rb

    r4524 r4544  
    2828def link(src, dst) 
    2929        puts "#{src} =>\n\t#{dst}" 
    30         src = File.expand_path(src) 
    31         dst = File.expand_path(dst) 
    32         remove_file dst if File.symlink?(dst) 
    33         remove_file dst if File.file?(dst) 
    34         ln_sf src, dst 
     30        src = Pathname.new(src).expand_path 
     31        dst = Pathname.new(dst).expand_path 
     32        dst.parent.mkpath unless dst.parent.exist? 
     33        remove_file dst if dst.symlink? 
     34        remove_file dst if dst.file? 
     35        ln_sf src.to_s, dst.to_s 
    3536end 
    3637