Skip to content
Snippets Groups Projects
Commit 7212d2e7 authored by Larbi Gharib's avatar Larbi Gharib
Browse files

Fix tmp folder exists

Change-Id: Ib4b9a1c0459346e8a965c022c203796cd258e642
parent 07be6cf0
No related branches found
No related tags found
No related merge requests found
......@@ -103,14 +103,27 @@ public class UpdateDownloader {
// temp folder for safe download and integrity check
File tmpFolder = new File(System.getProperty("user.dir") + "/tmp/");
if(!tmpFolder.mkdirs()){
log.error("Could not create temporary folder to store the update files!");
return false;
}
if(!tmpFolder.exists()){
try {
tmpFolder.mkdirs();
} catch (Exception e) {
log.error("Error creating folder:" + e);
return false;
}
}
files.forEach((k, v) -> {
try {
File tmpFile = new File( System.getProperty("user.dir") + "/tmp/" + v.getFileName());
if(tmpFile.exists()){
try{
tmpFile.delete();
} catch (Exception e) {
log.warn("Error deleting file: " + v.getFileName() + " with error " + e);
}
}
HttpClient httpClient = HttpClients.custom().setSSLContext(sslContext).build();
HttpResponse httpResponse = httpClient.execute(new HttpGet(UPDATE_SERVER_URL + "/updates/" + v.getFileName()));
if (httpResponse.getStatusLine().getStatusCode() != 200) return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment