From 0c86183009d912213114d29e6f2ff9e04f0b90ff Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sun, 26 Feb 2023 14:52:30 +0600 Subject: Fix: make sure outdir exists --- main.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 4cfa197..dab55dd 100644 --- a/main.go +++ b/main.go @@ -70,7 +70,7 @@ func hashStr(req string) string { func fpathToOutname(req string) string { basename := filepath.Base(req) h := hashStr(basename) - return path.Join(outdir, h+".opus") + return path.Join(outdir, h) } func linesToUtterances(lines []string, fd *FileData) []*Utterance { @@ -203,6 +203,10 @@ func main() { outdir = *outDirArg } + if err := os.MkdirAll(outdir, 0755); err != nil { + panic(err) + } + utterances := []*Utterance{} if vttDir != nil && *vttDir != "" { utterances = dirRun(*vttDir) @@ -217,11 +221,6 @@ func main() { } fmt.Println("sum of utterances:", len(utterances)) - - if err := os.MkdirAll(outdir, 0755); err != nil { - panic(err) - } - filteredUtterances := []*Utterance{} // === concurrent === -- cgit v1.2.3