35 lines
582 B
Go
35 lines
582 B
Go
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"
|
|
}
|
|
}
|