def __flush(self): """Write information to disk""" if not self.purged: self.__purge() if not os.path.exists(bleachbit.options_dir): General.makedirs(bleachbit.options_dir) mkfile = not os.path.exists(bleachbit.options_file) _file = open(bleachbit.options_file, 'wb') try: self.config.write(_file) except IOError as e: print(e) from errno import ENOSPC if e.errno == ENOSPC: logger.error("disk is full writing configuration '%s'", bleachbit.options_file) else: raise if mkfile and General.sudo_mode(): General.chownself(bleachbit.options_file)
def __flush(self): """Write information to disk""" if not self.purged: self.__purge() if not os.path.exists(bleachbit.options_dir): General.makedirs(bleachbit.options_dir) mkfile = not os.path.exists(bleachbit.options_file) with open(bleachbit.options_file, 'w', encoding='utf-8-sig') as _file: try: self.config.write(_file) except IOError as e: from errno import ENOSPC if e.errno == ENOSPC: logger.error( _("Disk was full when writing configuration to file %s"), bleachbit.options_file) else: raise if mkfile and General.sudo_mode(): General.chownself(bleachbit.options_file)
def __flush(self): if not self.purged: self.__purge() if not os.path.exists(bleachbit.options_dir): General.makedirs(bleachbit.options_dir) mkfile = not os.path.exists(bleachbit.options_file) _file = open(bleachbit.options_file, 'wb') try: self.config.write(_file) except IOError as e: print(e) from errno import ENOSPC if e.errno == ENOSPC: logger.error("disk is full writing configuration '%s'", bleachbit.options_file) else: raise if mkfile and General.sudo_mode(): General.chownself(bleachbit.options_file)
def start_with_computer(enabled): """If enabled, create shortcut to start application with computer. If disabled, then delete the shortcut.""" if not enabled: # User requests to not automatically start BleachBit if os.path.lexists(bleachbit.autostart_path): # Delete the shortcut FileUtilities.delete(bleachbit.autostart_path) return # User requests to automatically start BleachBit if os.path.lexists(bleachbit.autostart_path): # Already automatic, so exit return if not os.path.exists(bleachbit.launcher_path): logger.error('%s does not exist: ', bleachbit.launcher_path) return import shutil General.makedirs(os.path.dirname(bleachbit.autostart_path)) shutil.copy(bleachbit.launcher_path, bleachbit.autostart_path) os.chmod(bleachbit.autostart_path, 0o755) if General.sudo_mode(): General.chownself(bleachbit.autostart_path)