sync: import heading.jpg only in Sync phase

This commit is contained in:
nemunaire 2019-11-23 11:59:13 +01:00
parent 5dcb13629a
commit 26eab7ed67

View File

@ -99,17 +99,6 @@ func BuildTheme(i Importer, tdir string) (th *fic.Theme, errs []string) {
th.Image = path.Join(tdir, "heading.png")
}
if len(th.Image) > 0 {
if _, err := i.importFile(th.Image,
func(filePath string, origin string) (interface{}, error) {
th.Image = strings.TrimPrefix(filePath, fic.FilesDir)
return nil, nil
}); err != nil {
errs = append(errs, fmt.Sprintf("%q: unable to import heading image: %s", tdir, err))
return nil, errs
}
}
return
}
@ -132,6 +121,16 @@ func SyncThemes(i Importer) []string {
continue
}
if len(btheme.Image) > 0 {
if _, err := i.importFile(btheme.Image,
func(filePath string, origin string) (interface{}, error) {
btheme.Image = strings.TrimPrefix(filePath, fic.FilesDir)
return nil, nil
}); err != nil {
errs = append(errs, fmt.Sprintf("%q: unable to import heading image: %s", tdir, err))
}
}
var theme fic.Theme
if theme, err = fic.GetThemeByPath(btheme.Path); err != nil {
if _, err := fic.CreateTheme(*btheme); err != nil {