typora-installer/constants/constants.go

35 lines
582 B
Go
Raw Permalink Normal View History

2021-12-06 11:03:15 +00:00
package constants
import (
"os"
"path/filepath"
"runtime"
)
var WorkPath string
var ConfigPath string
var Installer string
func init() {
cache, err := os.UserCacheDir()
if err != nil {
panic(err)
}
WorkPath = filepath.Join(cache, "typora-installer")
conf, err := os.UserConfigDir()
if err != nil {
panic(err)
}
ConfigPath = filepath.Join(conf, "Typora")
switch runtime.GOOS {
case "linux":
Installer = runtime.GOARCH + "." + "tar.gz"
case "windows":
Installer = runtime.GOARCH + "." + "exe"
case "drawin":
Installer = runtime.GOARCH + "." + "dmg"
}
}