Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1111)

Unified Diff: dart/sdk/bin/dart2js

Issue 106863004: Support multiple levels of relative symlinks (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/bin/dart2js
diff --git a/dart/sdk/bin/dart2js b/dart/sdk/bin/dart2js
index 79a857be83efe500109c4f7c760fa2a9c008f2f9..63d55f933e1acc65741d4ea2a89a250a12094cb6 100755
--- a/dart/sdk/bin/dart2js
+++ b/dart/sdk/bin/dart2js
@@ -3,12 +3,25 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
+# The GNU version of readlink which has a -f option isn't available by default
+# on Mac OS X. So we provide our own version. We try to avoid calling external
+# programs such as dirname and readlink in the common case (not a symlink). The
+# reason for this is that we notice an overhead in calling external programs and
+# this affects script startup time which becomes notiable when running many
+# compilations in parallel (as it happens, for example, during testing).
function follow_links() {
file="$1"
while [ -h "$file" ]; do
kustermann 2013/12/06 13:50:41 I think, this doesn't work in all cases, e.g. /ho
- # On Mac OS, readlink -f doesn't work.
- file="$(readlink "$file")"
+ target="$(readlink "$file")"
+ if [[ "$target" != /* ]]; then
kustermann 2013/12/06 13:50:41 What does this do?
+ target="$(dirname "$file")/$target"
+ fi
+ file="$target"
done
+ # Make sure that ${foo%/*} can be used instead of dirname.
+ if [ "${file%/*}" = "$file" ]; then
+ file="./$file"
+ fi
kustermann 2013/12/06 13:50:41 Why is that necessary? (IMHO, a function follow_l
echo "$file"
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698