Beispiel #1
0
//保存所有配置文件
func (this *IndexInfo) SaveAllConf() (err error) {
	var (
		cfgPath string = "config/config.ini"
		retErr  error
	)
	xmlInies := GetXmlIniNames()
	cfg, _ := goconfig.LoadConfigFile(cfgPath)
	IndexInfoToCfg(this, cfg)
	retErr = goconfig.SaveConfig(cfg, cfgPath)
	for _, v := range xmlInies {
		xmlIniCfg, _ := goconfig.LoadConfigFile(v)
		IndexInfoToIni(this, xmlIniCfg)
		retErr = goconfig.SaveConfig(xmlIniCfg, v)
	}
	return retErr
}
Beispiel #2
0
/*动态读取配置文件*/
func ReadIniFile(filePath string, section string) map[string]string {
	var DIRS = make(map[string]string)
	c, _ := goconfig.LoadConfigFile(filePath)
	DIRS, _ = c.GetGroup(section)
	return DIRS
}