File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import (
33
33
"arduino.cc/builder/constants"
34
34
"arduino.cc/builder/types"
35
35
"arduino.cc/builder/utils"
36
+ "bytes"
36
37
"io/ioutil"
37
38
"path/filepath"
38
39
)
@@ -67,8 +68,22 @@ func (s *AdditionalSketchFilesCopier) Run(context map[string]interface{}) error
67
68
return utils .WrapError (err )
68
69
}
69
70
70
- utils .WriteFileBytes (targetFilePath , bytes )
71
+ if targetFileChanged (bytes , targetFilePath ) {
72
+ err := utils .WriteFileBytes (targetFilePath , bytes )
73
+ if err != nil {
74
+ return utils .WrapError (err )
75
+ }
76
+ }
71
77
}
72
78
73
79
return nil
74
80
}
81
+
82
+ func targetFileChanged (currentBytes []byte , targetFilePath string ) bool {
83
+ oldBytes , err := ioutil .ReadFile (targetFilePath )
84
+ if err != nil {
85
+ return true
86
+ }
87
+
88
+ return bytes .Compare (currentBytes , oldBytes ) != 0
89
+ }
You can’t perform that action at this time.
0 commit comments