From a8570987a6133ce4eee5be13dd1f7d2a75943adb Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 1 Jun 2021 19:40:11 -0400 Subject: [PATCH] island: Find MONKEY_ISLAND_ABS_PATH by __file__ instead of os.getcwd() We can't be sure what $PWD is when Monkey Island is started. --- monkey/monkey_island/cc/server_utils/consts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/server_utils/consts.py b/monkey/monkey_island/cc/server_utils/consts.py index 5cc9a0dd1..6f4382b87 100644 --- a/monkey/monkey_island/cc/server_utils/consts.py +++ b/monkey/monkey_island/cc/server_utils/consts.py @@ -1,4 +1,5 @@ import os +from pathlib import Path from monkey_island.cc.environment.utils import is_windows_os @@ -14,7 +15,7 @@ def get_default_data_dir() -> str: SERVER_CONFIG_FILENAME = "server_config.json" -MONKEY_ISLAND_ABS_PATH = os.path.join(os.getcwd(), "monkey_island") +MONKEY_ISLAND_ABS_PATH = str(Path(__file__).resolve().parent.parent.parent) DEFAULT_DATA_DIR = os.path.expandvars(get_default_data_dir())