mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	mkrunnable.rb: try mklink
* tool/mkrunnable.rb (Mswin#ln_safe): try mklink command if not linked already. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									c8141a8158
								
							
						
					
					
						commit
						759724fa2d
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -19,6 +19,7 @@ module Mswin
 | 
			
		|||
  def ln_safe(src, dest, *opt)
 | 
			
		||||
    cmd = ["mklink", dest.tr("/", "\\"), src.tr("/", "\\")]
 | 
			
		||||
    cmd[1, 0] = opt
 | 
			
		||||
    return if system("cmd", "/c", *cmd)
 | 
			
		||||
    # TODO: use RUNAS or something
 | 
			
		||||
    puts cmd.join(" ")
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			@ -64,12 +65,14 @@ def relative_path_from(path, base)
 | 
			
		|||
end
 | 
			
		||||
 | 
			
		||||
def ln_relative(src, dest)
 | 
			
		||||
  return if File.identical?(src, dest)
 | 
			
		||||
  parent = File.dirname(dest)
 | 
			
		||||
  File.directory?(parent) or mkdir_p(parent)
 | 
			
		||||
  ln_safe(relative_path_from(src, parent), dest)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def ln_dir_relative(src, dest)
 | 
			
		||||
  return if File.identical?(src, dest)
 | 
			
		||||
  parent = File.dirname(dest)
 | 
			
		||||
  File.directory?(parent) or mkdir_p(parent)
 | 
			
		||||
  ln_dir_safe(relative_path_from(src, parent), dest)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue