Skip to content

Commit

Permalink
Add checks for folder existence prior to processin
Browse files Browse the repository at this point in the history
  • Loading branch information
ydkhatri committed Aug 11, 2021
1 parent 77042ac commit b1b3fb6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion plugins/cfurl_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,16 @@ def Plugin_Start(mac_info):
'''Main Entry point function for plugin'''
cfurl_cache_artifacts = []
cfurl_cache_base_path = '{}/Library/Caches/'
processed_paths = set()

for user in mac_info.users:
cache_folder_list = mac_info.ListItemsInFolder(cfurl_cache_base_path.format(user.home_dir), EntryType.FOLDERS, include_dates=False)
if user.home_dir in processed_paths:
continue # Avoid processing same folder twice (some users have same folder! (Eg: root & daemon))
processed_paths.add(user.home_dir)
base_path = cfurl_cache_base_path.format(user.home_dir)
if not mac_info.IsValidFolderPath(base_path):
continue
cache_folder_list = mac_info.ListItemsInFolder(base_path, EntryType.FOLDERS, include_dates=False)
app_bundle_ids = [folder_item['name'] for folder_item in cache_folder_list]
for app_bundle_id in app_bundle_ids:
cache_folder_path = os.path.join(cfurl_cache_base_path.format(user.home_dir), app_bundle_id)
Expand Down

0 comments on commit b1b3fb6

Please sign in to comment.