mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-19 07:15:34 -04:00
tool/info-plist: decrease indentation and simplify (#3479)
This commit is contained in:
parent
71da59fd1c
commit
9cd1ce968d
@ -5,24 +5,21 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
func check(e error) {
|
|
||||||
if e != nil {
|
|
||||||
panic(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if runtime.GOOS != "darwin" {
|
if runtime.GOOS != "darwin" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(os.Args) == 3 {
|
if len(os.Args) != 3 {
|
||||||
if os.Args[1] == "darwin" && runtime.GOOS == "darwin" {
|
panic("missing arguments")
|
||||||
rawInfoPlistString := `<?xml version="1.0" encoding="UTF-8"?>
|
}
|
||||||
|
if os.Args[1] != "darwin" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rawInfoPlist := `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
@ -39,13 +36,10 @@ func main() {
|
|||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
`
|
`
|
||||||
infoPlistData := []byte(rawInfoPlistString)
|
|
||||||
|
|
||||||
err := ioutil.WriteFile("/tmp/micro-info.plist", infoPlistData, 0644)
|
err := os.WriteFile("/tmp/micro-info.plist", []byte(rawInfoPlist), 0644)
|
||||||
check(err)
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
fmt.Println("-linkmode external -extldflags -Wl,-sectcreate,__TEXT,__info_plist,/tmp/micro-info.plist")
|
fmt.Println("-linkmode external -extldflags -Wl,-sectcreate,__TEXT,__info_plist,/tmp/micro-info.plist")
|
||||||
}
|
|
||||||
} else {
|
|
||||||
panic("missing arguments")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user