借鉴:https://my.oschina.net/u/3041656/blog/793467
配置文件用于存储程序中的配置数据。配置文件会被分组(比如“config”和“cmd”),没个分组在其中有对应的各个变量值。如下:
#定义config分组
[config]
platformName = Android
appPackage = com.romwe
appActivity = com.romwe.SplashActivity
#定义cmd分组
[cmd]
viewPhone = adb devices
startServer = adb start-server
stopServer = adb kill-server
#定义log分组
[log]
log_error = true
基本的读取操作:
read(filename) 直接读取文件文件内容
section() 得到所有的section,并以列表的形式返回
options(section) 得到该section的所有option
items(section) 得到该section的所有键值对
get(section,option) 得到section中的option的值,返回为string类型
getint(section,option) 得到section中option的值,返回为int类型,还有相应的getboolean()和getfloat函数