7// ConfigDirPath returns the path to "f". Either f itself when absolute, or
8// interpreted relative to the directory of the static configuration file
10func ConfigDirPath(f string) string {
11 return configDirPath(ConfigStaticPath, f)
14// Like ConfigDirPath, but relative paths are interpreted relative to the directory
15// of the dynamic configuration file (domains.conf).
16func ConfigDynamicDirPath(f string) string {
17 return configDirPath(ConfigDynamicPath, f)
20// DataDirPath returns to the path to "f". Either f itself when absolute, or
21// interpreted relative to the data directory from the currently active
23func DataDirPath(f string) string {
24 return dataDirPath(ConfigStaticPath, Conf.Static.DataDir, f)
27// return f interpreted relative to the directory of the config dir. f is returned
28// unchanged when absolute.
29func configDirPath(configFile, f string) string {
30 if filepath.IsAbs(f) {
33 return filepath.Join(filepath.Dir(configFile), f)
36// return f interpreted relative to the data directory that is interpreted relative
37// to the directory of the config dir. f is returned unchanged when absolute.
38func dataDirPath(configFile, dataDir, f string) string {
39 if filepath.IsAbs(f) {
42 return filepath.Join(configDirPath(configFile, dataDir), f)