7// ConfigDirPath returns the path to "f". Either f itself when absolute, or
8// interpreted relative to the directory of the current config file.
9func ConfigDirPath(f string) string {
10 return configDirPath(ConfigStaticPath, f)
13// DataDirPath returns to the path to "f". Either f itself when absolute, or
14// interpreted relative to the data directory from the currently active
16func DataDirPath(f string) string {
17 return dataDirPath(ConfigStaticPath, Conf.Static.DataDir, f)
20// return f interpreted relative to the directory of the config dir. f is returned
21// unchanged when absolute.
22func configDirPath(configFile, f string) string {
23 if filepath.IsAbs(f) {
26 return filepath.Join(filepath.Dir(configFile), f)
29// return f interpreted relative to the data directory that is interpreted relative
30// to the directory of the config dir. f is returned unchanged when absolute.
31func dataDirPath(configFile, dataDir, f string) string {
32 if filepath.IsAbs(f) {
35 return filepath.Join(configDirPath(configFile, dataDir), f)