INNER CODE UNIT · Python
prepare_path
racenis/tram-sdk · devtools/codegen.py:8
def prepare_path(path):
# check if this is being run from the /src/ directory or project root
if not "/src" in path:
path = path + "/src/"
# strip file extension
if path.endswith(".h") or path.endswith(".cpp"):
path = path.removesuffix(".h")
path = path.removesuffix(".cpp")
if not path.endswith("/") and not path.endswith("\\"):
path = path + '/'
return path
def find_project_root(path):
path = path.replace("\\", "/")
path = path.split("/src")