summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-09-05 17:26:50 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-09-05 18:35:44 +0200
commit8f5515e887f99194cad0a3b8bfe30c91b4466d10 (patch)
treebcc8a97fe59e71b9a260b778180207524f5464fc
parente9509ea576f4fb1b65598435f0e13d1dcd127f7a (diff)
<third_party/WebKit> Prevent a python IOError on Windows due to MAX_PATH
Running python down into the WebKit directory structure and referring a file relatively to the build directory can easily spill over the 260 char limit on Windows. Resolve the absolute path using join and normpath to work around the issue. Change-Id: I6e89aad542761adcbd821b05f0cc6e9d489dced5 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r--chromium/third_party/WebKit/Source/bindings/scripts/utilities.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py b/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py
index 0aeabc20b36..f42918057a4 100644
--- a/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py
+++ b/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py
@@ -27,24 +27,33 @@ def idl_filename_to_interface_name(idl_filename):
# Basic file reading/writing
################################################################################
+def abs(filename):
+ # open, abspath, etc. are all limited to the 260 char MAX_PATH and this causes
+ # problems when we try to resolve long relative paths in the WebKit directory structure.
+ return os.path.normpath(os.path.join(os.getcwd(), filename))
+
def get_file_contents(filename):
+ filename = abs(filename)
with open(filename) as f:
return f.read()
def read_file_to_list(filename):
"""Returns a list of (stripped) lines for a given filename."""
+ filename = abs(filename)
with open(filename) as f:
return [line.rstrip('\n') for line in f]
def read_pickle_files(pickle_filenames):
for pickle_filename in pickle_filenames:
+ pickle_filename = abs(pickle_filename)
with open(pickle_filename) as pickle_file:
yield pickle.load(pickle_file)
def write_file(new_text, destination_filename, only_if_changed):
+ destination_filename = abs(destination_filename)
if only_if_changed and os.path.isfile(destination_filename):
with open(destination_filename) as destination_file:
if destination_file.read() == new_text:
@@ -54,6 +63,7 @@ def write_file(new_text, destination_filename, only_if_changed):
def write_pickle_file(pickle_filename, data, only_if_changed):
+ pickle_filename = abs(pickle_filename)
if only_if_changed and os.path.isfile(pickle_filename):
with open(pickle_filename) as pickle_file:
try: