diff --git a/file.go b/file.go index 496c271..6ffd4b0 100644 --- a/file.go +++ b/file.go @@ -467,19 +467,10 @@ func (fp* FilePages) saveBlocksFromPage(dirname string, page Page) error { } for id, block := range blocks { - log.Printf("Writing to %q\n", id) - f, err := os.OpenFile(filepath.Join(dirname, BlocksDirectory, id), os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644) - if err != nil { - log.Println(err) - continue - } - enc := json.NewEncoder(f) - enc.SetIndent("", " ") - err = enc.Encode(&block) + err := fp.blockRepo.SaveBlock(id, block) if err != nil { log.Println(err) } - f.Close() } return err