Skip to content

Commit

Permalink
Fix: Windows add_dll_directory Expand (#272)
Browse files Browse the repository at this point in the history
Expand paths in `PATH` environment variable before
adding them and make them absolute paths.
  • Loading branch information
ax3l authored Mar 1, 2024
1 parent 1b50287 commit bfb599f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/amrex/space1d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# add anything in PATH
paths = os.environ.get("PATH", "")
for p in paths.split(";"):
if os.path.exists(p):
os.add_dll_directory(p)
p_abs = os.path.abspath(os.path.expanduser(os.path.expandvars(p)))
if os.path.exists(p_abs):
os.add_dll_directory(p_abs)

# import core bindings to C++
from . import amrex_1d_pybind
Expand Down
5 changes: 3 additions & 2 deletions src/amrex/space2d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# add anything in PATH
paths = os.environ.get("PATH", "")
for p in paths.split(";"):
if os.path.exists(p):
os.add_dll_directory(p)
p_abs = os.path.abspath(os.path.expanduser(os.path.expandvars(p)))
if os.path.exists(p_abs):
os.add_dll_directory(p_abs)

# import core bindings to C++
from . import amrex_2d_pybind
Expand Down
5 changes: 3 additions & 2 deletions src/amrex/space3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# add anything in PATH
paths = os.environ.get("PATH", "")
for p in paths.split(";"):
if os.path.exists(p):
os.add_dll_directory(p)
p_abs = os.path.abspath(os.path.expanduser(os.path.expandvars(p)))
if os.path.exists(p_abs):
os.add_dll_directory(p_abs)

# import core bindings to C++
from . import amrex_3d_pybind
Expand Down

0 comments on commit bfb599f

Please sign in to comment.