def cleanup_assembly_files(): if coreutils.get_revit_instance_count() == 1: for asm_file_path in appdata.list_data_files(file_ext='dll'): if not assmutils.find_loaded_asm(asm_file_path, by_location=True): appdata.garbage_data_file(asm_file_path) asm_log_file = asm_file_path.replace('.dll', '.log') if op.exists(asm_log_file): appdata.garbage_data_file(asm_log_file)
def _cleanup_cache_files(): """ Upgrades local files and settings per this commit changes. commit message: Organized data files per Revit version in appdata folder commit hash: 44dd765c0f662f3faf5a40b92e3c5173804be37f """ cache_file_exts = ['pickle', 'json', 'log', 'pym'] for cache_file_ext in cache_file_exts: for cache_file_path in appdata.list_data_files(file_ext=cache_file_ext, universal=True): appdata.garbage_data_file(cache_file_path) # Cleanup Universal Dll files if get_revit_instance_count() == 1: for asm_file_path in appdata.list_data_files(file_ext='dll', universal=True): if not find_loaded_asm(asm_file_path, by_location=True): appdata.garbage_data_file(asm_file_path)
def __init__(self, xaml_file_name): forms.WPFWindow.__init__(self, xaml_file_name) self.hide_element(self.clrsearch_b) self._current_entry_list = [] self._log_files = \ {op.basename(f): f for f in appdata.list_data_files('log')} self.logfiles_cb.ItemsSource = self._log_files.keys() if logger.FILE_LOG_FILENAME in self._log_files.keys(): self.logfiles_cb.SelectedIndex = \ self.logfiles_cb.ItemsSource.index(logger.FILE_LOG_FILENAME) else: self.logfiles_cb.SelectedIndex = 0
import os import os.path as op from pyrevit.coreutils import appdata __doc__ = 'Deletes all the temporary selection data files folder. '\ 'This will clear all selection memories.' for pymemfile in appdata.list_data_files('.pym'): print('Removing: {}'.format(pymemfile)) os.remove(pymemfile)
def cleanup_assembly_files(): if get_revit_instance_count() == 1: for asm_file_path in appdata.list_data_files(file_ext='dll'): if not find_loaded_asm(asm_file_path, by_location=True): appdata.garbage_data_file(asm_file_path)