Skip to content
Snippets Groups Projects
Commit 739e663c authored by Christian Pointner's avatar Christian Pointner
Browse files

fix clean up fo show creation

parent b370279a
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ func (st *Store) getShowPath(show string) string {
}
func (st *Store) createShow(tx *gorm.DB, name string) (show *Show, err error) {
showDirPath := filepath.Join(st.basePath, name)
showDirPath := st.getShowPath(name)
if err := os.Mkdir(showDirPath, 0755); err != nil {
if !os.IsExist(err) {
return nil, errors.New("unable to create directory for show '" + name + "': " + err.Error())
......@@ -51,6 +51,9 @@ func (st *Store) createShow(tx *gorm.DB, name string) (show *Show, err error) {
}
show = &Show{Name: name}
err = tx.FirstOrCreate(show).Error
if err != nil {
os.RemoveAll(showDirPath)
}
return
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment