Skip to content

Commit

Permalink
Prevent file from being overwritten if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
andscoop committed Sep 24, 2018
1 parent b1b1ec7 commit 87d178e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion airflow/airflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ func initFiles(root string, files map[string]string) error {
fullpath := filepath.Join(root, file)

// Move on if already exists
_, err := fileutil.Exists(fullpath)
fileExist, err := fileutil.Exists(fullpath)
if err != nil {
return errors.Wrapf(err, "failed to check existence of '%s'", fullpath)
}

if fileExist {
continue
}

// Write files out
if err := fileutil.WriteStringToFile(fullpath, content); err != nil {
return errors.Wrapf(err, "failed to create file '%s'", fullpath)
Expand Down

0 comments on commit 87d178e

Please sign in to comment.