Skip to content

Commit e0902e3

Browse files
committed
[core] Make better use of os.sep where applicable
1 parent da5035b commit e0902e3

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

xpp/core/interpreter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, args: list, mem: Memory) -> None:
2121
# Interpreter class
2222
class Interpreter(object):
2323
def __init__(self, entrypoint: str, sections: list, **kwargs) -> None:
24-
self.entrypoint = entrypoint.replace("\\", "/").split("/")[-1].removesuffix(".xpp")
24+
self.entrypoint = entrypoint.split(os.sep)[-1].removesuffix(".xpp")
2525
self.sections = sections
2626

2727
self.stack, self.memory = [], Memory(**{"interpreter": self} | kwargs)

xpp/core/sections.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ def load_sections(source: str, filepath: str, namespace: str = None) -> list:
5656
"""
5757

5858
# Calculate file name
59-
filepath = filepath.replace("\\", "/")
60-
filename = namespace or filepath.split("/")[-1].removesuffix(".xpp")
59+
filename = namespace or filepath.split(os.sep)[-1].removesuffix(".xpp")
6160

6261
# Initialization
6362
data = {"sections": [{"sid": f"{filename}.main", "path": filepath, "lines": [], "start": 1, "args": []}], "active": 0}

0 commit comments

Comments
 (0)