lib/pbmenv.rb in pbmenv-0.1.7 vs lib/pbmenv.rb in pbmenv-0.1.8

- old
+ new

@@ -76,13 +76,18 @@ if !File.exists?("/usr/share/pbm/#{version}") && !File.exists?("/usr/share/pbm/v#{version}") return false end - if File.exists?("#{PBM_DIR}/current") + if File.symlink?("#{PBM_DIR}/current") system_and_puts "unlink #{PBM_DIR}/current" end - system_and_puts "ln -s #{PBM_DIR}/v#{version} #{PBM_DIR}/current" + + if(version_number = version.match(/v?([\w.]+)/)[1]) + system_and_puts "ln -s #{PBM_DIR}/v#{version_number} #{PBM_DIR}/current" + else + raise "mismatch version number!" + end end def self.download_src(version) if ENV["DEBUG_INSTALL"] shell = <<~SHELL