Fix early out behavior on file export

This commit is contained in:
Alex Yatskov 2021-08-16 20:39:38 -07:00
parent a6226fc79b
commit e751d70f27

View File

@ -101,11 +101,9 @@ func (file *File) GoString() string {
func (file *File) export(targetDir string) error { func (file *File) export(targetDir string) error {
targetPath := filepath.Join(targetDir, file.sourcePath) targetPath := filepath.Join(targetDir, file.sourcePath)
if len(file.dataPath) == 0 { if targetInfo, err := os.Stat(targetPath); err == nil && !targetInfo.ModTime().Before(file.ModTime()) {
if targetInfo, err := os.Stat(targetPath); err == nil && targetInfo.ModTime().After(file.ModTime()) {
return nil return nil
} }
}
if err := os.MkdirAll(path.Dir(targetPath), 0755); err != nil { if err := os.MkdirAll(path.Dir(targetPath), 0755); err != nil {
return err return err