func (c *sConfig) ConfigFile() string {
	return c.file
}
ConfigFile  implement
package sconfig
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	_toml "github.com/BurntSushi/toml"
	"github.com/bitly/go-simplejson"
	"github.com/ghodss/yaml"
	"github.com/pelletier/go-toml"
	"github.com/scryinfo/dot/dot"
	"github.com/scryinfo/scryg/sutils/sfile"
)
var (
	_ dot.SConfig = (*sConfig)(nil)  
)
type sConfig struct {
	confPath   string            
	file       string            
	fileType   string            
	simpleJSON *simplejson.Json  
}
const (
	extensionNameJson = ".json"  
	extensionNameYaml = ".yaml"  
	extensionNameToml = ".toml"  
	separator         = "_"      
	conf              = "conf"
)
func NewConfig() *sConfig {
	return &sConfig{}
}
func (c *sConfig) RootPath() {
	if ex, err := os.Executable(); err == nil {
		exPath := filepath.Dir(ex)
		binPath := filepath.Dir(exPath)
		exName := filepath.Base(ex)
		ext := filepath.Ext(ex)
		exName = exName[0 : len(exName)-len(ext)]
		if sfile.ExistFile(dot.GCmd.ConfigPath) {
			c.confPath = dot.GCmd.ConfigPath
		} else if configPath := filepath.Join(exPath, exName+separator+conf); sfile.ExistFile(configPath) {
			c.confPath = configPath
		} else if configPath := filepath.Join(exPath, conf); sfile.ExistFile(configPath) {
			c.confPath = configPath
		} else if configPath := filepath.Join(binPath, exName+separator+conf); sfile.ExistFile(configPath) {  
			c.confPath = configPath
		} else if configPath := filepath.Join(binPath, conf); sfile.ExistFile(configPath) {
			c.confPath = configPath
		}
		if len(c.confPath) < 1 {
			c.confPath = exPath
		}
		if file := filepath.Join(c.confPath, dot.GCmd.ConfigFile); len(dot.GCmd.ConfigFile) > 0 && sfile.ExistFile(file) {
			c.file = dot.GCmd.ConfigFile
			c.getFileType()
		} else if file := filepath.Join(c.confPath, exName+extensionNameJson); sfile.ExistFile(file) {
			c.file = exName + extensionNameJson
			c.fileType = extensionNameJson
		} else if file := filepath.Join(c.confPath, conf+extensionNameJson); sfile.ExistFile(file) {
			c.file = conf + extensionNameJson
			c.fileType = extensionNameJson
		} else if file := filepath.Join(c.confPath, exName+extensionNameToml); sfile.ExistFile(file) {
			c.file = exName + extensionNameToml
			c.fileType = extensionNameToml
		} else if file := filepath.Join(c.confPath, conf+extensionNameToml); sfile.ExistFile(file) {
			c.file = conf + extensionNameToml
			c.fileType = extensionNameToml
		} else if file := filepath.Join(c.confPath, exName+extensionNameYaml); sfile.ExistFile(file) {
			c.file = exName + extensionNameYaml
			c.fileType = extensionNameYaml
		} else if file := filepath.Join(c.confPath, conf+extensionNameYaml); sfile.ExistFile(file) {
			c.file = conf + extensionNameYaml
			c.fileType = extensionNameYaml
		}
	}
	if len(c.confPath) > 0 && !sfile.ExistFile(c.confPath) {
		err := os.MkdirAll(c.confPath, os.ModePerm)
		if err != nil {
			logger := dot.Logger()
			if logger != nil {
				logger.Debugln(fmt.Sprint(err))
			}
		}
	}
}
func (c *sConfig) Create(l dot.Line) error {
	fname := filepath.Join(c.ConfigPath(), c.ConfigFile())
	if len(c.ConfigFile()) < 1 || !sfile.ExistFile(fname) {
		return nil
	}
	f, err := os.Open(fname)
	if err != nil {
		return err
	}
	if state, err := f.Stat(); err == nil && state.Size() < 1 {
		return nil
	}
	defer f.Close()
	switch c.fileType {
	case extensionNameJson:
		c.simpleJSON, err = simplejson.NewFromReader(f)
	case extensionNameToml:
		t, err := toml.LoadReader(f)
		if err == nil {
			jsonStr, err := json.Marshal(t.ToMap())
			if err == nil {
				c.simpleJSON, err = simplejson.NewJson(jsonStr)
			}
		}
	case extensionNameYaml:
		var yamlBytes, jsonBytes []byte
		yamlBytes, err = ioutil.ReadAll(f)
		jsonBytes, err = yaml.YAMLToJSON(yamlBytes)
		if err == nil {
			c.simpleJSON, err = simplejson.NewJson(jsonBytes)
		}
	}
	return err
}
func (c *sConfig) Destroy(ignore bool) error {
	c.simpleJSON = nil
	return nil
}
func (c *sConfig) ConfigPath() string {
	return c.confPath
}