Skip to content

Commit

Permalink
[core] Make better use of os.sep where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
iiPythonx committed Apr 7, 2023
1 parent da5035b commit e0902e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion xpp/core/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions xpp/core/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit e0902e3

Please sign in to comment.