aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-08-07 22:39:23 -0700
committerAdam Vandenberg2010-08-07 22:39:23 -0700
commit353d9561e786599540973f5cbe6933a1fd998d1e (patch)
tree3f53e222cceda8a1b755ee6338ad9477e37ddcb4 /Library
parentfd39ff2da672b12b4d1e55b8a1d00d1a3e63e00c (diff)
downloadbrew-353d9561e786599540973f5cbe6933a1fd998d1e.tar.bz2
brew-linkapps - expand the target path once.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/examples/brew-linkapps.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/Library/Contributions/examples/brew-linkapps.rb b/Library/Contributions/examples/brew-linkapps.rb
index bcaf7a9e3..a5affaed2 100755
--- a/Library/Contributions/examples/brew-linkapps.rb
+++ b/Library/Contributions/examples/brew-linkapps.rb
@@ -1,8 +1,10 @@
# Links any Applications (.app) found in installed prefixes to ~/Applications
require "formula"
-unless File.exist? File.expand_path("~/Applications")
- opoo File.expand_path("~/Applications")+" does not exist, stopping."
+HOME_APPS = File.expand_path("~/Applications")
+
+unless File.exist? HOME_APPS
+ opoo "#{HOME_APPS} does not exist, stopping."
exit 1
end
@@ -14,7 +16,7 @@ HOMEBREW_CELLAR.subdirs.each do |keg|
Dir["#{f.prefix}/*.app"].each do |p|
puts "Linking #{p}"
appname = File.basename(p)
- target = File.expand_path("~/Applications")+"/"+appname
+ target = HOME_APPS+"/"+appname
if File.exist? target
if File.symlink? target
system "rm", target
@@ -22,7 +24,7 @@ HOMEBREW_CELLAR.subdirs.each do |keg|
onoe "#{target} already exists, skipping."
end
end
- system "ln", "-s", p, File.expand_path("~/Applications")
+ system "ln", "-s", p, HOME_APPS
end
end
end