Skip to content

Commit

Permalink
Added detection of directory duplication (close #366)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Nov 17, 2023
1 parent 66d5be3 commit d021cf3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
16 changes: 16 additions & 0 deletions CB/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,22 @@ def check_if_dev(self, url):
else:
return 0

def check_if_overlap(self):
directories = []
found = set()
for addon in self.config['Addons']:
directories = directories + addon['Directories']
dupes = [x for x in directories if x in found or found.add(x)]
if len(dupes) > 0:
addons = []
for addon in self.config['Addons']:
if set(addon['Directories']).intersection(dupes):
addons.append(addon['Name'])
addons.sort()
return '\n'.join(addons)
else:
return False

def check_if_blocked(self, addon):
if addon:
if 'Block' in addon.keys():
Expand Down
3 changes: 3 additions & 0 deletions CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ def c_update(self, args, addline=False, update=True, force=False, reverseprovide
self.console.print(self.table)
if compacted > 0:
self.console.print(f'Additionally [green]{compacted}[/green] addons are up-to-date.')
overlap = self.core.check_if_overlap()
if overlap:
self.console.print(f'\n[bold red]Detected addon directory overlap. This will cause issues. Affected addons:[/bold red]\n{overlap}')
else:
self.console.print('Apparently there are no addons installed by CurseBreaker (or you provided incorrect add'
'on name).\nCommand [green]import[/green] might be used to detect already installed addo'
Expand Down
30 changes: 15 additions & 15 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d021cf3

Please sign in to comment.