Merge pull request '2022.10.12 - Fixed cpl g existing __init__.py overwrite #116' (#118) from 2022.10.12-#116 into 2022.10

Reviewed-on: #118
Closes #118
This commit is contained in:
Sven Heidemann 2022-09-30 14:07:07 +02:00
commit 82df528395

View File

@ -153,10 +153,16 @@ class GenerateService(CommandABC):
if not os.path.isdir(os.path.dirname(file_path)): if not os.path.isdir(os.path.dirname(file_path)):
os.makedirs(os.path.dirname(file_path)) os.makedirs(os.path.dirname(file_path))
directory = '' directory = ''
print()
for subdir in template.path.split('/'): for subdir in template.path.split('/'):
directory = os.path.join(directory, subdir) directory = os.path.join(directory, subdir)
if subdir != 'src': if subdir == 'src':
continue
file = InitTemplate(class_name, schematic, self._schematics[schematic]["Upper"], rel_path) file = InitTemplate(class_name, schematic, self._schematics[schematic]["Upper"], rel_path)
if os.path.exists(os.path.join(os.path.abspath(directory), file.name)):
continue
Console.spinner( Console.spinner(
f'Creating {os.path.abspath(directory)}/{file.name}', f'Creating {os.path.abspath(directory)}/{file.name}',
self._create_file, self._create_file,