Skip to content

Commit

Permalink
Update epanet.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariosmsk committed Apr 16, 2024
1 parent 1150d9f commit 37434cd
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions epyt/epanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -15655,21 +15655,22 @@ class epanetmsxapi:
"""example msx = epanetmsxapi()"""

def __init__(self, msxfile='', ignore_msxfile=False):
ops = platform.system().lower()
if ops in ["windows"]:
self.MSXLibEPANET = resource_filename("epyt", os.path.join("libraries", "win", "epanetmsx.dll"))
elif ops in ["darwin"]:
self.MSXLibEPANET = resource_filename("epyt", os.path.join("libraries", "mac", "epanetmsx.dylib"))
else:
self.MSXLibEPANET = resource_filename("epyt", os.path.join("libraries", "glnx", "epanetmsx.so"))
if not ignore_msxfile:

ops = platform.system().lower()
if ops in ["windows"]:
self.MSXLibEPANET = resource_filename("epyt", os.path.join("libraries", "win", "epanetmsx.dll"))
elif ops in ["darwin"]:
self.MSXLibEPANET = resource_filename("epyt", os.path.join("libraries", "mac", "epanetmsx.dylib"))
else:
self.MSXLibEPANET = resource_filename("epyt", os.path.join("libraries", "glnx", "epanetmsx.so"))

self.msx_lib = cdll.LoadLibrary(self.MSXLibEPANET)
self.MSXLibEPANETPath = os.path.dirname(self.MSXLibEPANET)
self.msx_lib = cdll.LoadLibrary(self.MSXLibEPANET)
self.MSXLibEPANETPath = os.path.dirname(self.MSXLibEPANET)

self.msx_error = self.msx_lib.MSXgeterror
self.msx_error.argtypes = [c_int, c_char_p, c_int]
self.msx_error = self.msx_lib.MSXgeterror
self.msx_error.argtypes = [c_int, c_char_p, c_int]

if not ignore_msxfile:
if not os.path.exists(msxfile):
raise FileNotFoundError(f"File not found: {msxfile}")

Expand Down

0 comments on commit 37434cd

Please sign in to comment.