Merge pull request #27 from bartschuller/realpath

Use realpath to locate relative files, add python impl
This commit is contained in:
Josh Suereth 2012-11-05 12:39:46 -08:00
commit b84dac7a1d
2 changed files with 21 additions and 1 deletions

View File

@ -49,7 +49,7 @@ object Packaging {
fixedLinuxScriptDir <<= target / "linux-scripts",
fixedUniversalScriptDir <<= target / "universal-scripts",
linuxFixedScripts <<= (fixedScriptDir, fixedLinuxScriptDir) map fixScripts("/usr/lib/sbt/sbt-launch.jar", "/usr/share/sbt/sbt-launch-lib.bash"),
universalFixedScripts <<= (fixedScriptDir, fixedUniversalScriptDir) map fixScripts("\\$(dirname \\$0)/sbt-launch.jar", "\\$(dirname \\$0)/sbt-launch-lib.bash"),
universalFixedScripts <<= (fixedScriptDir, fixedUniversalScriptDir) map fixScripts("\\$(dirname \\$(realpath \\$0))/sbt-launch.jar", "\\$(dirname \\$(realpath \\$0))/sbt-launch-lib.bash"),
sbtLaunchJarUrl <<= sbtVersion apply downloadUrlForVersion,
sbtLaunchJarLocation <<= target apply (_ / "sbt-launch.jar"),
sbtLaunchJar <<= (sbtLaunchJarUrl, sbtLaunchJarLocation) map { (uri, file) =>

View File

@ -1,5 +1,25 @@
#!/usr/bin/env bash
realpath () {
(
TARGET_FILE=$1
cd $(dirname $TARGET_FILE)
TARGET_FILE=$(basename $TARGET_FILE)
COUNT=0
while [ -L "$TARGET_FILE" -a $COUNT -lt 100 ]
do
TARGET_FILE=$(readlink $TARGET_FILE)
cd $(dirname $TARGET_FILE)
TARGET_FILE=$(basename $TARGET_FILE)
COUNT=$(($COUNT + 1))
done
echo $(pwd -P)/$TARGET_FILE
)
}
. @@BASH-LIB-LOCATION@@