brew-linkapps - expand the target path once.
This commit is contained in:
parent
fd39ff2da6
commit
353d9561e7
@ -1,8 +1,10 @@
|
|||||||
# Links any Applications (.app) found in installed prefixes to ~/Applications
|
# Links any Applications (.app) found in installed prefixes to ~/Applications
|
||||||
require "formula"
|
require "formula"
|
||||||
|
|
||||||
unless File.exist? File.expand_path("~/Applications")
|
HOME_APPS = File.expand_path("~/Applications")
|
||||||
opoo File.expand_path("~/Applications")+" does not exist, stopping."
|
|
||||||
|
unless File.exist? HOME_APPS
|
||||||
|
opoo "#{HOME_APPS} does not exist, stopping."
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -14,7 +16,7 @@ HOMEBREW_CELLAR.subdirs.each do |keg|
|
|||||||
Dir["#{f.prefix}/*.app"].each do |p|
|
Dir["#{f.prefix}/*.app"].each do |p|
|
||||||
puts "Linking #{p}"
|
puts "Linking #{p}"
|
||||||
appname = File.basename(p)
|
appname = File.basename(p)
|
||||||
target = File.expand_path("~/Applications")+"/"+appname
|
target = HOME_APPS+"/"+appname
|
||||||
if File.exist? target
|
if File.exist? target
|
||||||
if File.symlink? target
|
if File.symlink? target
|
||||||
system "rm", target
|
system "rm", target
|
||||||
@ -22,7 +24,7 @@ HOMEBREW_CELLAR.subdirs.each do |keg|
|
|||||||
onoe "#{target} already exists, skipping."
|
onoe "#{target} already exists, skipping."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
system "ln", "-s", p, File.expand_path("~/Applications")
|
system "ln", "-s", p, HOME_APPS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user