1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

WTF-400 Todo extracted to new config format

This commit is contained in:
Chris Cummer
2019-04-13 10:07:53 -07:00
parent b43c9485b8
commit cf661e7e15
5 changed files with 90 additions and 17 deletions

View File

@@ -96,17 +96,17 @@ func NamesFromEmails(emails []string) []string {
// OpenFile opens the file defined in `path` via the operating system
func OpenFile(path string) {
if (strings.HasPrefix(path,"http://"))||(strings.HasPrefix(path,"https://")) {
if (strings.HasPrefix(path, "http://")) || (strings.HasPrefix(path, "https://")) {
switch runtime.GOOS {
case "linux":
exec.Command("xdg-open", path).Start()
case "windows":
exec.Command("rundll32", "url.dll,FileProtocolHandler", path).Start()
case "darwin":
exec.Command("open", path).Start()
default:
case "linux":
exec.Command("xdg-open", path).Start()
case "windows":
exec.Command("rundll32", "url.dll,FileProtocolHandler", path).Start()
case "darwin":
exec.Command("open", path).Start()
default:
}
}else {
} else {
filePath, _ := ExpandHomeDir(path)
openFileUtil := Config.UString("wtf.openFileUtil", "open")
cmd := exec.Command(openFileUtil, filePath)