File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import (
3333 "arduino.cc/builder/constants"
3434 "arduino.cc/builder/types"
3535 "arduino.cc/builder/utils"
36+ "bytes"
3637 "io/ioutil"
3738 "path/filepath"
3839)
@@ -67,8 +68,22 @@ func (s *AdditionalSketchFilesCopier) Run(context map[string]interface{}) error
6768 return utils .WrapError (err )
6869 }
6970
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+ }
7177 }
7278
7379 return nil
7480}
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