-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcopy_language_configuration.py
More file actions
executable file
·29 lines (24 loc) · 1 KB
/
copy_language_configuration.py
File metadata and controls
executable file
·29 lines (24 loc) · 1 KB
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
#!/usr/bin/env python
import pathlib
import os
import shutil
import sys
def main(path_to_extension):
target_directory = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'resources')
if not os.path.exists(path_to_extension):
raise Exception(f'{path_to_extension} does not exist')
for root, dir, files in os.walk(path_to_extension):
for f in files:
if f == 'language-configuration.json':
language_configuration = os.path.join(root, f)
language_directory = os.path.join(
target_directory,
pathlib.Path(root).relative_to(path_to_extension))
if not os.path.exists(language_directory):
os.mkdir(language_directory)
print(
f'Copy: {language_configuration} => {language_directory}')
shutil.copy(language_configuration, language_directory)
if __name__ == '__main__':
main(sys.argv[1])