Skip to content

Commit

Permalink
unix work
Browse files Browse the repository at this point in the history
  • Loading branch information
nosuchtim committed Dec 30, 2023
1 parent 60e4c4e commit b159b07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions kit/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func InitLog(logname string) {
LogInfo("InitLog ==============================", "date", date, "logname", logname)
}

func LogFatal(err error) {
TheLog.Fatal(err)
}

func SummarizeLog(fname string) error {
file, err := os.Open(fname)
if err != nil {
Expand Down
12 changes: 5 additions & 7 deletions kit/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,12 @@ func MIDIFilePath(nm string) string {
func LocalPaletteDir() string {
localapp := os.Getenv("CommonProgramFiles")
if localapp == "" {
var err error
tempdir, err := GetParam("global.tempdir")
LogWarn("Expecting CommonProgramFiles to be set, using global.tempdir value", "tempdir", tempdir)
if err != nil {
LogIfError(err)
return ""
home := os.Getenv("HOME")
localapp = filepath.Join(home,"commonfiles","Palette")
if err := os.MkdirAll(localapp, os.ModePerm); err != nil {
LogFatal(err)
}
localapp = tempdir
LogInfo("LocalPaletteDir using HOME","localapp",localapp)
}
return filepath.Join(localapp, "Palette")
}
Expand Down

0 comments on commit b159b07

Please sign in to comment.