aboutsummaryrefslogtreecommitdiff
path: root/tools/file_packager.py
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2014-03-07 13:40:52 +0200
committerJukka Jylänki <jujjyl@gmail.com>2014-03-07 13:41:15 +0200
commit8e536ebe3ee36b7fe5319d9a2fa8280fe81d57e7 (patch)
treeb6395cd57023bc590f23e57eb37f29c155ba916a /tools/file_packager.py
parentd960419db2df7577d4fc96f1933dee697229c19c (diff)
Resolve symbolic links when checking for destination locations in file_packager. Fixes browser.test_preload_file on OSX.
Diffstat (limited to 'tools/file_packager.py')
-rw-r--r--tools/file_packager.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/file_packager.py b/tools/file_packager.py
index 12cc5475..cbad25d5 100644
--- a/tools/file_packager.py
+++ b/tools/file_packager.py
@@ -113,7 +113,7 @@ for arg in sys.argv[2:]:
try:
from shared import CRUNCH
except Exception, e:
- print >> sys.stderr, 'count not import CRUNCH (make sure it is defined properly in ~/.emscripten)'
+ print >> sys.stderr, 'could not import CRUNCH (make sure it is defined properly in ~/.emscripten)'
raise e
crunch = arg.split('=')[1] if '=' in arg else '128'
leading = ''
@@ -223,13 +223,14 @@ if len(data_files) == 0:
sys.exit(1)
# Absolutize paths, and check that they make sense
-curr_abspath = os.path.abspath(os.getcwd())
+curr_abspath = os.path.abspath(os.getcwd()) # os.getcwd() always returns the hard path with any symbolic links resolved, even if we cd'd into a symbolic link.
+
for file_ in data_files:
if file_['srcpath'] == file_['dstpath']:
# This file was not defined with src@dst, so we inferred the destination from the source. In that case,
# we require that the destination not be under the current location
path = file_['dstpath']
- abspath = os.path.abspath(path)
+ abspath = os.path.realpath(os.path.abspath(path)) # Use os.path.realpath to resolve any symbolic links to hard paths, to match the structure in curr_abspath.
if DEBUG: print >> sys.stderr, path, abspath, curr_abspath
if not abspath.startswith(curr_abspath):
print >> sys.stderr, 'Error: Embedding "%s" which is below the current directory "%s". This is invalid since the current directory becomes the root that the generated code will see' % (path, curr_abspath)