Skip to content

Commit 9e7d94e

Browse files
committed
Improve js2c.py to always produce relative path to src
Signed-off-by: Yonggang Luo <[email protected]>
1 parent 584ae6a commit 9e7d94e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/js2c.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from common_py.system.filesystem import FileSystem as fs
2727
from common_py import path
2828

29+
src_root_dir = os.path.join(os.path.dirname(__file__), '..', 'src')
2930

3031
def normalize_str(text):
3132
if not isinstance(text, str):
@@ -203,7 +204,9 @@ def get_snapshot_contents(js_path, snapshot_tool, literals=None):
203204
cmd = [snapshot_tool, "generate", "-o", snapshot_path]
204205
if literals:
205206
cmd.extend(["--static", "--load-literals-list-format", literals])
206-
ret = subprocess.call(cmd + [wrapped_path])
207+
wrapped_rel_path = os.path.relpath(wrapped_path, src_root_dir)
208+
wrapped_rel_path = wrapped_rel_path.replace('\\', '/')
209+
ret = subprocess.call(cmd + [wrapped_rel_path], cwd=src_root_dir)
207210

208211
fs.remove(wrapped_path)
209212
if ret != 0:

0 commit comments

Comments
 (0)