Skip to content

Commit

Permalink
Merge pull request #24 from simracingstudio/patch-3
Browse files Browse the repository at this point in the history
Update library.py
  • Loading branch information
tyrylu committed Apr 1, 2021
2 parents 24798bd + 2c5700f commit 806e402
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pyfmodex/studio/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import platform
import sys

arch = platform.architecture()[0]
if os.name == "nt":
Expand All @@ -15,10 +16,18 @@

LIBRARY = None


def get_library():
"""Load libary file according to architecture's ctype method."""
global LIBRARY
if not LIBRARY:
LIBRARY = library_type.LoadLibrary(LIBRARY_NAME)
try:
LIBRARY = library_type.LoadLibrary(LIBRARY_NAME)
except:
current_directory = os.path.dirname(os.path.realpath(sys.argv[0]))
try:
LIBRARY = library_type.LoadLibrary(os.path.join(current_directory, LIBRARY_NAME))
except:
raise RuntimeError(
"Pyfmodex could not find the " + LIBRARY_NAME + " library")

return LIBRARY

0 comments on commit 806e402

Please sign in to comment.