Check path to index file when saving

This commit is contained in:
Daniel 2020-06-26 22:44:32 +02:00
parent 545e8e6821
commit 38902d8c82

View file

@ -60,6 +60,12 @@ func (reg *ResourceRegistry) downloadIndex(idx Index) error {
log.Warningf("%s: failed to add resources: %s", reg.Name, err)
}
// check if dest dir exists
err = reg.storageDir.EnsureRelPath(filepath.Dir(idx.Path))
if err != nil {
log.Warningf("%s: failed to ensure directory for updated index %s: %s", reg.Name, idx.Path, err)
}
// save index
err = ioutil.WriteFile(filepath.Join(reg.storageDir.Path, idx.Path), data, 0644)
if err != nil {