Use dot as folder separator

Also don't add dot if no extension
This commit is contained in:
Dan Jones 2024-02-26 19:30:32 -06:00
commit a61af1b4b3
4 changed files with 74 additions and 4 deletions

View file

@ -16,7 +16,14 @@ func Append(l models.Log) error {
return err
}
filename := fmt.Sprintf("%s.%s", strings.ReplaceAll(l.Name, ".", string(os.PathSeparator)), conf.Input.Ext)
filename := l.Name
if conf.Input.DotFolder {
filename = strings.ReplaceAll(filename, ".", string(os.PathSeparator))
}
if conf.Input.Ext != "" {
filename = fmt.Sprintf("%s.%s", filename, conf.Input.Ext)
}
path := fp.Join(conf.Input.Path, filename)
dir := fp.Dir(path)
err = os.MkdirAll(dir, 0750)