Skip to content

Commit

Permalink
Allow using any absolute or relative paths on Linux and Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Oct 7, 2021
1 parent 9af4321 commit 4ae03d9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pypi/yowasp_yosys/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ def _run_wasm_app(wasm_filename, argv):
wasi_cfg.argv = argv
wasi_cfg.preopen_dir(str(importlib_resources.files(__package__) / "share"), "/share")
wasi_cfg.preopen_dir(_tempdir.name, "/tmp")
wasi_cfg.preopen_dir("/", "/")
if os.name == "nt":
for letter in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ":
wasi_cfg.preopen_dir(letter + ":\\", letter + ":")
else:
wasi_cfg.preopen_dir("/", "/")
wasi_cfg.preopen_dir(".", ".")
# sby needs to run `yowasp-yosys -ql ../model/design.log ../model/design.ys`
wasi_cfg.preopen_dir("..", "..")
for level in range(len(pathlib.Path().cwd().parts)):
wasi_cfg.preopen_dir(str(pathlib.Path("").joinpath(*[".."] * level)),
"/".join([".."] * level))
wasi_cfg.inherit_stdin()
wasi_cfg.inherit_stdout()
wasi_cfg.inherit_stderr()
Expand Down

0 comments on commit 4ae03d9

Please sign in to comment.