main.go 520 B

1234567891011121314151617181920212223242526272829
  1. package main
  2. import (
  3. "os"
  4. "path/filepath"
  5. _ "embed"
  6. )
  7. //go:embed icon.ico
  8. var appIcon []byte
  9. func main() {
  10. relaunchInUserSession()
  11. dir := executableDir()
  12. app := newApp(LoadConfig(dir), filepath.Join(dir, ".env"))
  13. app.Run()
  14. }
  15. // executableDir returns the directory containing the running executable,
  16. // falling back to the working directory when os.Executable fails.
  17. func executableDir() string {
  18. if exe, err := os.Executable(); err == nil {
  19. return filepath.Dir(exe)
  20. }
  21. wd, _ := os.Getwd()
  22. return wd
  23. }