OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 function follow_links() { | 6 PROG_NAME=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && \ |
7 file="$1" | 7 PROG_NAME=$PROG_NAME/$(basename -- "$0") |
8 while [ -h "$file" ]; do | |
9 # On Mac OS, readlink -f doesn't work. | |
10 file="$(readlink "$file")" | |
ahe
2013/12/06 08:06:30
The problem is this line. On Mac, this reads the l
| |
11 done | |
12 echo "$file" | |
13 } | |
14 | 8 |
15 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 9 # resolve symlinks |
16 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 10 while [ -h $PROG_NAME ]; do |
11 DIR=$(dirname -- "$PROG_NAME") | |
12 SYM=$(readlink $PROG_NAME) | |
13 PROG_NAME=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM") | |
14 done | |
17 | 15 |
18 # Handle the case where dart-sdk/bin has been symlinked to. | 16 # Handle the case where dart-sdk/bin has been symlinked to. |
19 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | 17 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
20 | 18 |
21 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" | 19 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
22 | 20 |
23 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" | 21 DART2JS="$SDK_DIR/lib/_internal/compiler/implementation/dart2js.dart" |
24 | 22 |
25 DART="$BIN_DIR/dart" | 23 DART="$BIN_DIR/dart" |
26 | 24 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 if [[ $DART_VM_OPTIONS ]]; then | 59 if [[ $DART_VM_OPTIONS ]]; then |
62 read -a OPTIONS <<< "$DART_VM_OPTIONS" | 60 read -a OPTIONS <<< "$DART_VM_OPTIONS" |
63 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") | 61 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") |
64 fi | 62 fi |
65 | 63 |
66 if test -f "$SNAPSHOT"; then | 64 if test -f "$SNAPSHOT"; then |
67 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@" | 65 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$SNAPSHOT" "${EXTRA_OPTIONS[@]}" "$@" |
68 else | 66 else |
69 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" | 67 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "$DART2JS" "${EXTRA_OPTIONS[@]}" "$@" |
70 fi | 68 fi |
OLD | NEW |