skip copying files only when there is a data path

This commit is contained in:
Alex Yatskov 2019-04-06 17:32:53 -07:00
parent bf1f01b9bf
commit 6bbd9e7b28

View File

@ -80,9 +80,12 @@ func (file *File) Seek(offset int64, whence int) (int64, error) {
func (file *File) export(targetDir string) error {
targetPath := filepath.Join(targetDir, file.sourcePath)
if len(file.dataPath) == 0 {
if targetInfo, err := os.Stat(targetPath); err == nil && targetInfo.ModTime().After(file.ModTime()) {
return nil
}
}
if err := os.MkdirAll(path.Dir(targetPath), 0755); err != nil {
return err