[improvement][arch] 'clean cache' removing the whole folder instead of each file

This commit is contained in:
Vinícius Moreira
2020-05-08 17:50:30 -03:00
parent 9509aa89e7
commit 81a7b682d6
2 changed files with 8 additions and 9 deletions

View File

@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [0.9.3] 2020 ## [0.9.3] 2020
### Fixes ### Fixes
- Arch
- 'clean cache' operation was not working in some scenarios
- upgrade: crashing for scenarios when there are packages that cannot upgrade to be displayed on the summary window - upgrade: crashing for scenarios when there are packages that cannot upgrade to be displayed on the summary window
- settings: crashing when an empty Qt style is defined [#104](https://github.com/vinifmor/bauh/issues/104) - settings: crashing when an empty Qt style is defined [#104](https://github.com/vinifmor/bauh/issues/104)

View File

@@ -2165,20 +2165,16 @@ class ArchManager(SoftwareManager):
deny_label=self.i18n['cancel'].capitalize()): deny_label=self.i18n['cancel'].capitalize()):
handler = ProcessHandler(watcher) handler = ProcessHandler(watcher)
success = True rm = SimpleProcess(cmd=['rm', '-rf', cache_dir], root_password=root_password)
for f in glob.glob('{}/*'.format(cache_dir)): success, _ = handler.handle_simple(rm)
rm = SimpleProcess(cmd=['rm', '-rf', f], root_password=root_password)
success, _ = handler.handle_simple(rm)
if not success:
success = False
break
if success: if success:
watcher.show_message(title=self.i18n['arch.custom_action.clean_cache'].capitalize(), watcher.show_message(title=self.i18n['arch.custom_action.clean_cache'].capitalize(),
body=self.i18n['arch.custom_action.clean_cache.success'], body=self.i18n['arch.custom_action.clean_cache.success'],
type_=MessageType.INFO) type_=MessageType.INFO)
mkcache = SimpleProcess(cmd=['mkdir', '-p', cache_dir], root_password=root_password)
handler.handle_simple(mkcache)
return True return True
else: else:
watcher.show_message(title=self.i18n['arch.custom_action.clean_cache'].capitalize(), watcher.show_message(title=self.i18n['arch.custom_action.clean_cache'].capitalize(),