|
@@ -23,6 +23,12 @@ func DownloadUpdatesFromURL(binaryURL string, webpackURL string, progressUpdateF
|
|
binaryDownloadTarget := "./updates/" + filepath.Base(binaryURL)
|
|
binaryDownloadTarget := "./updates/" + filepath.Base(binaryURL)
|
|
webpackDownloadTarget := "./updates/" + filepath.Base(webpackURL)
|
|
webpackDownloadTarget := "./updates/" + filepath.Base(webpackURL)
|
|
|
|
|
|
|
|
+ //Check if the webpack is .tar.gz
|
|
|
|
+ if filepath.Ext(webpackDownloadTarget) != ".gz" {
|
|
|
|
+ //This is not a gzip file
|
|
|
|
+ return errors.New("Webpack in invalid compression format")
|
|
|
|
+ }
|
|
|
|
+
|
|
//Start the download of binary
|
|
//Start the download of binary
|
|
//0 = false, 1 = true, 2 = error
|
|
//0 = false, 1 = true, 2 = error
|
|
binaryDownloadComplete := 0
|
|
binaryDownloadComplete := 0
|
|
@@ -40,6 +46,8 @@ func DownloadUpdatesFromURL(binaryURL string, webpackURL string, progressUpdateF
|
|
progressUpdateFunction(0, 100, "Binary Download Completed")
|
|
progressUpdateFunction(0, 100, "Binary Download Completed")
|
|
} else {
|
|
} else {
|
|
progressUpdateFunction(0, 100, "Error: "+errorMessage)
|
|
progressUpdateFunction(0, 100, "Error: "+errorMessage)
|
|
|
|
+ //Remove the update folder
|
|
|
|
+ os.RemoveAll("./updates/")
|
|
}
|
|
}
|
|
|
|
|
|
}()
|
|
}()
|
|
@@ -64,6 +72,8 @@ func DownloadUpdatesFromURL(binaryURL string, webpackURL string, progressUpdateF
|
|
progressUpdateFunction(1, 100, "Webpack Download Completed")
|
|
progressUpdateFunction(1, 100, "Webpack Download Completed")
|
|
} else {
|
|
} else {
|
|
progressUpdateFunction(1, 100, "Error: "+errorMessage)
|
|
progressUpdateFunction(1, 100, "Error: "+errorMessage)
|
|
|
|
+ //Remove the update folder
|
|
|
|
+ os.RemoveAll("./updates/")
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
err = downloadFile(webpackURL, webpackDownloadTarget)
|
|
err = downloadFile(webpackURL, webpackDownloadTarget)
|