You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
817 B
40 lines
817 B
package config
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// should return the dir path of the exe file
|
|
func getConfigContainerBesidesExe() string {
|
|
if os.Getenv("DEBUG") == "true" {
|
|
path, err := os.Getwd()
|
|
if err != nil {
|
|
log.Fatal("Failed to Get Work Dir", err)
|
|
}
|
|
return path
|
|
} else {
|
|
executablePath, err := os.Executable()
|
|
if err != nil {
|
|
log.Fatal("Failed to Get Executable Path", err)
|
|
}
|
|
executableDir := filepath.Dir(executablePath)
|
|
return executableDir
|
|
}
|
|
}
|
|
|
|
func getConfigContainerUserConfig(appName string) string {
|
|
dir, err := os.UserConfigDir()
|
|
if err != nil {
|
|
log.Fatal("Failed to Get User Config Dir", err)
|
|
}
|
|
dir = filepath.Join(dir, appName)
|
|
return dir
|
|
}
|
|
|
|
func getConfigContainerSystemConfig(appName string) string {
|
|
log.Fatal("Error, not Implemented yet")
|
|
return ""
|
|
}
|