fix: fetch should respect root

This commit is contained in:
Mustafa Gezen 2021-09-30 20:28:02 +02:00
parent 6483386e19
commit ef5bd995b1
Signed by: mustafa
GPG Key ID: DCDF010D946438C1

View File

@ -80,12 +80,12 @@ func Fetch(cdnUrl string, dir string) error {
return fmt.Errorf("checksum in metadata does not match dist-git file") return fmt.Errorf("checksum in metadata does not match dist-git file")
} }
err = os.MkdirAll(filepath.Dir(path), 0755) err = os.MkdirAll(filepath.Join(dir, filepath.Dir(path)), 0755)
if err != nil { if err != nil {
return fmt.Errorf("could create all directories") return fmt.Errorf("could create all directories")
} }
f, err := os.Create(path) f, err := os.Create(filepath.Join(dir, path))
if err != nil { if err != nil {
return fmt.Errorf("could not open file pointer: %v", err) return fmt.Errorf("could not open file pointer: %v", err)
} }