diff --git a/.gitignore b/.gitignore index bda025b..2ab8488 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .idea /generation -src/utils/generation/ __pycache__/ .python-version diff --git a/src/utils/globals.py b/src/utils/globals.py index 33a7388..f14beb9 100644 --- a/src/utils/globals.py +++ b/src/utils/globals.py @@ -52,9 +52,8 @@ class Color(Enum): # Json BASE_INDENT = " " JSON_SUFFIX = ".json" -APPLICATION_PATH = os.path.realpath( - os.path.dirname(__file__).replace("\\src", "").replace("\\utils", "") -) +_CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) +APPLICATION_PATH = os.path.dirname(os.path.dirname(_CURRENT_DIR)) DEFAULT_FLOOR_NAME = "floor" DEFAULT_FLOOR_DIRECTORY = "generation" diff --git a/test/globals_test.py b/test/globals_test.py index a65d56e..383cf6c 100644 --- a/test/globals_test.py +++ b/test/globals_test.py @@ -92,10 +92,8 @@ def test_json_suffix(self): self.assertEqual(".json", globals.JSON_SUFFIX) def test_path(self): - self.assertEqual( - os.path.realpath(os.path.dirname(__file__).replace("\\test", "")), - globals.APPLICATION_PATH, - ) + project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + self.assertEqual(project_root, globals.APPLICATION_PATH) if __name__ == "__main__":