initial commit

This commit is contained in:
2025-01-23 16:00:50 +08:00
commit 70fe1ab91e
5 changed files with 179 additions and 0 deletions

39
path-helper.go Normal file
View File

@@ -0,0 +1,39 @@
package main
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 ""
}