-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
48 lines (40 loc) · 883 Bytes
/
Copy pathmain.go
File metadata and controls
48 lines (40 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
"log"
"os"
"runtime"
"github.com/adrg/xdg"
"github.com/lmorg/ttyphoon/app"
"github.com/lmorg/ttyphoon/config"
"github.com/lmorg/ttyphoon/utils/cache"
)
func main() {
if runtime.GOOS == "darwin" {
err := os.Setenv("PATH", "PATH="+os.Getenv("PATH")+":/usr/bin:/opt/homebrew/bin:/opt/homebrew/sbin")
if err != nil {
panic(err)
}
}
config.ReadEnvConfig()
cacheDbFile := "cache.db"
cacheDbPath, err := xdg.CacheFile(cacheDbFile)
if err != nil {
log.Println(err)
cacheDbPath = fmt.Sprintf("%s/%s-%s", os.TempDir(), app.DirName, cacheDbFile)
}
cache.SetPath(cacheDbPath)
cache.InitCache()
startWails()
}
func cdHome() {
// default to $HOME
home, err := os.UserHomeDir()
if err != nil {
os.Stderr.WriteString(err.Error())
} else {
if err = os.Chdir(home); err != nil {
os.Stderr.WriteString(err.Error())
}
}
}