mirror of
https://github.com/safing/portbase
synced 2025-09-02 10:40:39 +00:00
Check path to index file when saving
This commit is contained in:
parent
545e8e6821
commit
38902d8c82
1 changed files with 6 additions and 0 deletions
|
@ -60,6 +60,12 @@ func (reg *ResourceRegistry) downloadIndex(idx Index) error {
|
||||||
log.Warningf("%s: failed to add resources: %s", reg.Name, err)
|
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
|
// save index
|
||||||
err = ioutil.WriteFile(filepath.Join(reg.storageDir.Path, idx.Path), data, 0644)
|
err = ioutil.WriteFile(filepath.Join(reg.storageDir.Path, idx.Path), data, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue