MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / init_configuration

Function init_configuration

bleachbit/Options.py:112–126  ·  view source on GitHub ↗

Initialize an empty configuration, if necessary

(*, log=True)

Source from the content-addressed store, hash-verified

110
111
112def init_configuration(*, log=True):
113 """Initialize an empty configuration, if necessary"""
114 if not os.path.exists(bleachbit.options_dir):
115 General.makedirs(bleachbit.options_dir)
116 if os.path.lexists(bleachbit.options_file):
117 if log:
118 logger.debug('Deleting configuration: %s', bleachbit.options_file)
119 os.remove(bleachbit.options_file)
120 with open(bleachbit.options_file, 'w', encoding='utf-8-sig') as f_ini:
121 f_ini.write('[bleachbit]\n')
122 if os.name == 'nt' and bleachbit.portable_mode:
123 f_ini.write('[Portable]\n')
124 for section in options.config.sections():
125 options.config.remove_section(section)
126 options.restore()
127
128
129class Options:

Callers 1

setUpMethod · 0.90

Calls 2

restoreMethod · 0.80
writeMethod · 0.45

Tested by 1

setUpMethod · 0.72