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

Unified Diff: grit/node/misc.py

Issue 69463002: Properly substitute variables that reference paths outside SRCDIR. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | grit/node/misc_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/node/misc.py
===================================================================
--- grit/node/misc.py (revision 137)
+++ grit/node/misc.py (working copy)
@@ -49,7 +49,6 @@
def ReplaceVariable(matchobj):
for key, value in defines.iteritems():
if matchobj.group(1) == key:
- value = os.path.abspath(value)[len(src_root_dir) + 1:]
return value
return ''
@@ -58,7 +57,12 @@
new_grd_filename = re.sub(r'<\(([A-Za-z_]+)\)', ReplaceVariable,
grd_filename)
if new_grd_filename != grd_filename:
- new_grd_filename = new_grd_filename.replace('\\', '/')
+ abs_grd_filename = os.path.abspath(new_grd_filename)
+ if abs_grd_filename[:len(src_root_dir)] != src_root_dir:
+ new_grd_filename = os.path.basename(abs_grd_filename)
+ else:
+ new_grd_filename = abs_grd_filename[len(src_root_dir) + 1:]
+ new_grd_filename = new_grd_filename.replace('\\', '/')
renames.append((grd_filename, new_grd_filename))
for grd_filename, new_grd_filename in renames:
« no previous file with comments | « no previous file | grit/node/misc_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698