diff --git a/xpp/core/interpreter.py b/xpp/core/interpreter.py index 1b6a797..8e81103 100644 --- a/xpp/core/interpreter.py +++ b/xpp/core/interpreter.py @@ -21,7 +21,7 @@ def __init__(self, args: list, mem: Memory) -> None: # Interpreter class class Interpreter(object): def __init__(self, entrypoint: str, sections: list, **kwargs) -> None: - self.entrypoint = entrypoint.replace("\\", "/").split("/")[-1].removesuffix(".xpp") + self.entrypoint = entrypoint.split(os.sep)[-1].removesuffix(".xpp") self.sections = sections self.stack, self.memory = [], Memory(**{"interpreter": self} | kwargs) diff --git a/xpp/core/sections.py b/xpp/core/sections.py index a4cd938..c497996 100644 --- a/xpp/core/sections.py +++ b/xpp/core/sections.py @@ -56,8 +56,7 @@ def load_sections(source: str, filepath: str, namespace: str = None) -> list: """ # Calculate file name - filepath = filepath.replace("\\", "/") - filename = namespace or filepath.split("/")[-1].removesuffix(".xpp") + filename = namespace or filepath.split(os.sep)[-1].removesuffix(".xpp") # Initialization data = {"sections": [{"sid": f"{filename}.main", "path": filepath, "lines": [], "start": 1, "args": []}], "active": 0}