Path fixing when creating files that need URIs
This commit is contained in:
parent
5159301831
commit
0739eb4091
|
@ -400,7 +400,8 @@ class JsDependencyGraph(object):
|
|||
rel_path = os.path.relpath(dep_file.src_path, base_path)
|
||||
rel_path = anvil.util.strip_build_paths(rel_path)
|
||||
lines.append('goog.addDependency(\'%s\', %s, %s);' % (
|
||||
rel_path, dep_file.provides, dep_file.requires))
|
||||
anvil.util.ensure_forwardslashes(rel_path),
|
||||
dep_file.provides, dep_file.requires))
|
||||
return u'\n'.join(lines)
|
||||
|
||||
def get_transitive_closure(self, entry_points):
|
||||
|
|
|
@ -37,6 +37,18 @@ def get_script_path():
|
|||
return os.path.dirname(os.path.abspath(inspect.stack()[1][1]))
|
||||
|
||||
|
||||
def ensure_forwardslashes(path):
|
||||
"""Fixes a potentially Windows-esque file path into a valid URI.
|
||||
|
||||
Args:
|
||||
path: File path, maybe containing \\.
|
||||
|
||||
Returns:
|
||||
The input path with the separators flipped to URI standard /.
|
||||
"""
|
||||
return string.replace(path, '\\', '/')
|
||||
|
||||
|
||||
def strip_build_paths(path):
|
||||
"""Strips out build-*/ from the given path.
|
||||
|
||||
|
|
Loading…
Reference in New Issue