You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
)
|
|
|
|
|
|
|
|
func check(e error, s string) {
|
|
|
|
if e != nil {
|
|
|
|
fmt.Errorf(s)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func dots(count int) string {
|
|
|
|
dotStr := ""
|
|
|
|
for i := 0; i < count; i++ {
|
|
|
|
dotStr += "."
|
|
|
|
}
|
|
|
|
return dotStr
|
|
|
|
}
|
|
|
|
|
|
|
|
func stripExtension(filename string) string {
|
|
|
|
ext := filepath.Ext(filename)
|
|
|
|
return filename[:len(filename)-len(ext)]
|
|
|
|
}
|
|
|
|
|
|
|
|
func makeOutputDir() {
|
|
|
|
// Default to just "output"
|
|
|
|
err := os.Mkdir("output", 0755)
|
|
|
|
check(err, "cannot make directory")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func clearOutputDir() {
|
|
|
|
err := os.RemoveAll("./output")
|
|
|
|
check(err, "cannot remove directory")
|
|
|
|
return
|
|
|
|
}
|