Updated the readconfig library instances missed
@@ -175,13 +175,13 @@ class PreferencesBridge(PioBridge):
"""
# list of programmers
-
- programmer = get_setting('programmer_id', None)
ini_path = self.get_ini_path()
+ programmer = get_setting('programmer_id', None)
+
# open platformio.ini and get the environment
- Config = ReadConfig()
- ini_file = Config.read(ini_path)
+ config = ReadConfig()
+ config.read(ini_path)
environment = 'env:{0}'.format(self.board_id)
# stop if environment wasn't initialized yet
@@ -233,28 +233,28 @@ class PreferencesBridge(PioBridge):
The path of the folder must be set from the option
`add extra folder` in the library option menu
"""
- lib_flag = 'lib_extra_dirs'
+ flag = 'lib_extra_dirs'
ini_path = self.get_ini_path()
extra = get_setting('extra_library', None)
- Config = ConfigParser()
- ini_file = Config.read(ini_path)
+ config = ReadConfig()
+ config.read(ini_path)
+
environment = 'env:{0}'.format(self.board_id)
- if(environment not in ini_file):
+ if(not config.has_section(environment)):
return
- env = ini_file[environment]
-
if(not extra):
- if('lib_extra_dirs' in env):
- env.pop('lib_extra_dirs')
+ if(config.has_option(environment, flag)):
+ config.remove_option(environment, flag)
if(extra):
- extra_option = {'lib_extra_dirs': extra}
- env.merge(extra_option)
+ config.set(environment, flag, extra)
- ini_file.write()
+ # save in file
+ with open(ini_path, 'w') as configfile:
+ config.write(configfile)
def exclude_ino(self, remove=False):
"""Add extra library folder
@@ -300,7 +300,7 @@ class PreferencesBridge(PioBridge):
ini_path = self.get_ini_path()
baudrate = get_setting('upload_baudrate', None)
- config = ConfigParser()
+ config = ReadConfig()
ini_file = config.read(ini_path)
environment = 'env:' + self.board_id
