explicitly which and check pygmentize bin. ref #15
This commit is contained in:
parent
4d9a8a231e
commit
8116d5abe3
@ -14,7 +14,8 @@ import (
|
||||
)
|
||||
|
||||
var cacheDir = "/tmp/gobyexample-cache"
|
||||
var siteDir = "site"
|
||||
var siteDir = ""
|
||||
var pygmentizeBin = ""
|
||||
|
||||
func check(err error) {
|
||||
if err != nil {
|
||||
@ -110,9 +111,17 @@ func whichSiteDir() {
|
||||
dir := os.Getenv("SITEDIR")
|
||||
if dir != "" {
|
||||
siteDir = dir
|
||||
} else {
|
||||
siteDir = "site"
|
||||
}
|
||||
}
|
||||
|
||||
func whichPygmentize() {
|
||||
bin, err := exec.LookPath("pygmentize")
|
||||
check(err)
|
||||
pygmentizeBin = bin
|
||||
}
|
||||
|
||||
func debug(msg string) {
|
||||
if os.Getenv("DEBUG") == "1" {
|
||||
fmt.Fprintln(os.Stderr, msg)
|
||||
@ -245,6 +254,7 @@ func renderExamples(examples []*Example) {
|
||||
|
||||
func main() {
|
||||
whichSiteDir()
|
||||
whichPygmentize()
|
||||
ensureDir(siteDir)
|
||||
copyFile("templates/site.css", siteDir+"/site.css")
|
||||
copyFile("templates/favicon.ico", siteDir+"/favicon.ico")
|
||||
|
Loading…
x
Reference in New Issue
Block a user