Skip to content

Commit

Permalink
Get config from binary location for Pyinstaller bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
tinajohnson committed Nov 17, 2024
1 parent 6ca8678 commit 991f864
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fakenet/diverters/diverterbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,7 @@ def generate_html_report(self):
"""
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
# Inside a Pyinstaller bundle
fakenet_dir_path = os.getcwd()
fakenet_dir_path = os.path.dirname(sys.executable)
else:
fakenet_dir_path = os.fspath(Path(__file__).parents[1])

Expand Down
2 changes: 1 addition & 1 deletion fakenet/fakenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, logging_level = logging.INFO):
def parse_config(self, config_filename):
# Handling Pyinstaller bundle scenario: https://pyinstaller.org/en/stable/runtime-information.html
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
dir_path = os.getcwd()
dir_path = os.path.dirname(sys.executable)
else:
dir_path = os.path.dirname(__file__)

Expand Down
2 changes: 1 addition & 1 deletion fakenet/listeners/ListenerBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def abs_config_path(path):
return abspath

if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
relpath = os.path.join(os.getcwd(), path)
relpath = os.path.join(os.path.dirname(sys.executable), path)
else:

# Try to locate the location relative to application path
Expand Down

0 comments on commit 991f864

Please sign in to comment.