Skip to content

Commit 46bd8e8

Browse files
author
Federico Fissore
committed
When a test lib is newer, ensure the old one is deleted
Signed-off-by: Federico Fissore <[email protected]>
1 parent 60d3295 commit 46bd8e8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/arduino.cc/builder/test/helper_tools_downloader.go

+8
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,14 @@ func downloadAndUnpackLibrary(library Library, url string, targetPath string) er
728728
}
729729
defer os.RemoveAll(unpackFolder)
730730

731+
_, err = os.Stat(filepath.Join(targetPath, strings.Replace(library.Name, " ", "_", -1)))
732+
if err == nil {
733+
err = os.RemoveAll(filepath.Join(targetPath, strings.Replace(library.Name, " ", "_", -1)))
734+
if err != nil {
735+
return utils.WrapError(err)
736+
}
737+
}
738+
731739
err = copyRecursive(filepath.Join(unpackFolder, files[0].Name()), filepath.Join(targetPath, strings.Replace(library.Name, " ", "_", -1)))
732740
if err != nil {
733741
return utils.WrapError(err)

0 commit comments

Comments
 (0)