File tree Expand file tree Collapse file tree 1 file changed +3
-15
lines changed Expand file tree Collapse file tree 1 file changed +3
-15
lines changed Original file line number Diff line number Diff line change 34
34
def get_circuitpython_root_dir ():
35
35
""" The path to the root './circuitpython' directory
36
36
"""
37
- cwd = pathlib .Path ('.' ).resolve ()
38
- cwd_parts = cwd . parts
37
+ file_path = pathlib .Path (__file__ ).resolve ()
38
+ root_dir = file_path . parent . parent
39
39
40
- root_idx = len (cwd_parts )
41
-
42
- # Search the path from tail to head, so that we capture the
43
- # deepest folder. This avoids overshooting in instances like:
44
- # '/home/user/circuitpython_v5/circuitpython'
45
- for idx , val in enumerate (cwd_parts [::- 1 ]):
46
- if val .startswith ("circuitpython" ):
47
- root_idx = root_idx - idx
48
- break
49
-
50
- root_dir = '/' .join (cwd_parts [:root_idx ])
51
-
52
- return pathlib .Path (root_dir ).resolve ()
40
+ return root_dir
53
41
54
42
def get_shared_bindings ():
55
43
""" Get a list of modules in shared-bindings based on folder names
You can’t perform that action at this time.
0 commit comments