INNER CODE UNIT · Python
find_project_root
racenis/tram-sdk · devtools/codegen.py:23
def find_project_root(path):
path = path.replace("\\", "/")
path = path.split("/src")
return path[0]
def make_file(name):
path = prepare_path(os.getcwd()) + name.replace("-", "").lower()
# check if file already generated
is_h = os.path.isfile(path + ".h")
is_cpp = os.path.isfile(path + ".cpp")
if is_h:
print("File", path + ".h", "already exists!")
sys.exit()
if is_cpp:
print("File", path + ".cpp", "already exists!")