diff --git a/.gitignore b/.gitignore index 9daeafb..b2fd0dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +*.css test diff --git a/distribusi b/distribusi index 09850e9..27fc778 100755 Binary files a/distribusi and b/distribusi differ diff --git a/distribusi.go b/distribusi.go index 9301d3b..9e93e81 100644 --- a/distribusi.go +++ b/distribusi.go @@ -547,8 +547,6 @@ func mkDiv(c *cli.Context, mtype string, href, fname string, unknown bool) (stri // writeIndex writes a new index.html. func writeIndex(fpath string, html []string, styles string) error { body := fmt.Sprintf(htmlBody, generatedInDistribusi, "", strings.Join(html, "\n")) - HTMLPath := path.Join(fpath, "index.html") - contents := []byte(body) if styles != "" { absPath, err := filepath.Abs(styles) @@ -566,6 +564,9 @@ func writeIndex(fpath string, html []string, styles string) error { } } + HTMLPath := path.Join(fpath, "index.html") + contents := []byte(body) + if _, err := os.Stat(HTMLPath); err != nil { if os.IsNotExist(err) { if err := ioutil.WriteFile(HTMLPath, contents, 0644); err != nil {