forked from pybricks/pybricks-projects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_workspaces.py
executable file
·43 lines (34 loc) · 991 Bytes
/
update_workspaces.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
from os import scandir, path
from json import dump
def make_workspace(root):
# Get list of folder names
names = [d.name for d in scandir(root) if d.is_dir()]
names.sort()
# Make the workspace dictionary
workspace = {
"folders": [
{
"path": name
}
for name in names
],
"settings": {
"debug.openDebug": "neverOpen"
}
}
# Work space name is same as path
workspace_name = root.replace('/', '_').replace('\\', '_')
workspace_name += '.code-workspace'
# Save workspace
with open(path.join(root, workspace_name), 'w') as f:
dump(workspace, f, indent=4)
# Make all the workspaces
roots = (
path.join('sets', 'ev3', 'education_core'),
path.join('sets', 'ev3', 'education_expansion'),
path.join('sets', 'ev3', 'home'),
path.join('sets', 'ev3', 'home_bonus'),
)
for root in roots:
make_workspace(root)