Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #6 from kowey/dev
Browse files Browse the repository at this point in the history
fancier symlink hunting
  • Loading branch information
gimbo committed Mar 29, 2012
2 parents 301a740 + dc4779f commit ec85fc0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 19 additions & 3 deletions Distribution/MacOSX.hs
Expand Up @@ -88,10 +88,26 @@ appBundleInstallHook apps _ iflags pkg localb = when isMacOS $ do
installExecutableFile verbosity (exe appPathSrc) (exe appPathTgt)
-- generate a tiny shell script for users who expect to run their
-- applications from the command line with flags and all
let script = "`dirname $0`" </> "../Applications"
let script = unlines [ "#!/bin/bash"
, "COUNTER=0"
, "MAX_DEPTH=256"
, "ZERO=$0"
, "NZERO=`readlink $ZERO`; STATUS=$?"
, ""
, "# The counter is just a safeguard in case I'd done something silly"
, "while [ $STATUS -eq 0 -a $COUNTER -lt $MAX_DEPTH ]; do"
, " let COUNTER=COUNTER+1"
, " ZERO=$NZERO"
, " NZERO=`readlink $ZERO`; STATUS=$?"
, "done"
, "if [ $COUNTER -ge $MAX_DEPTH ]; then"
, " echo >&2 Urk! exceeded symlink depth of $MAX_DEPTH trying to dereference $0"
, " exit 1"
, "fi"
, "`dirname $ZERO`" </> "../Applications"
</> takeFileName appPathSrc
</> "Contents/MacOS" </> appName app
++ " \"$@\""
</> "Contents/MacOS" </> appName app ++ " \"$@\""
]
scriptFileSrc = buildDir localb </> "_" ++ appName app <.> "sh"
scriptFileTgt = bindir installDir </> appName app
writeFile scriptFileSrc script
Expand Down
2 changes: 1 addition & 1 deletion cabal-macosx.cabal
@@ -1,5 +1,5 @@
Name: cabal-macosx
Version: 0.2
Version: 0.2.1
Stability: Alpha
Synopsis: Cabal support for creating Mac OSX application bundles.
Description:
Expand Down

0 comments on commit ec85fc0

Please sign in to comment.