MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / build_tree

Function build_tree

tools/targets/vsc.py:64–78  ·  view source on GitHub ↗
(paths)

Source from the content-addressed store, hash-verified

62
63
64def build_tree(paths):
65 tree = {}
66 current_working_directory = os.getcwd()
67 current_folder_name = os.path.basename(current_working_directory)
68 # Filter out invalid and non-existent paths
69 relative_dirs = []
70 for path in paths:
71 normalized_path = os.path.normpath(path)
72 try:
73 rel_path = os.path.relpath(normalized_path, start=current_working_directory)
74 add_path_to_tree(tree, normalized_path)
75 except ValueError:
76 print(f"Remove unexcpect dir:{path}")
77
78 return tree
79
80def print_tree(tree, indent=''):
81 for key, subtree in sorted(tree.items()):

Callers 1

Calls 1

add_path_to_treeFunction · 0.85

Tested by

no test coverage detected