From 44ea7455e1f440a8df4070604213b390c21e7a3d Mon Sep 17 00:00:00 2001 From: axtloss Date: Wed, 24 May 2023 23:43:57 +0200 Subject: Add command line options --- .../java/io/github/jshipit/BlobDownloader.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/main/java/io/github/jshipit/BlobDownloader.java') diff --git a/src/main/java/io/github/jshipit/BlobDownloader.java b/src/main/java/io/github/jshipit/BlobDownloader.java index 3aafec4..850e1ac 100644 --- a/src/main/java/io/github/jshipit/BlobDownloader.java +++ b/src/main/java/io/github/jshipit/BlobDownloader.java @@ -53,7 +53,6 @@ public class BlobDownloader extends Thread { throw new RuntimeException("Failed : HTTP error code : " + con.getResponseCode()); } else { - System.out.println("Success: " + con.getResponseCode()); } } catch (IOException e) { System.out.println("Failed to connect"); @@ -79,17 +78,18 @@ public class BlobDownloader extends Thread { e.printStackTrace(); } - if (this.renameTo == null) { + if (this.renameTo == null && !extract) { + return; + } else if (this.renameTo != null) { + Path rename = new File(renameTo).toPath(); + Path current = new File(tmpdir + "/" + digest.replace("sha256:", "")+".tar.gz").toPath(); + try { + Files.move(current, rename); + } catch (IOException e) { + System.out.println("Failed to rename file "+digest); + e.printStackTrace(); + } return; - } - - Path rename = new File(renameTo).toPath(); - Path current = new File(tmpdir + "/" + digest.replace("sha256:", "")+".tar.gz").toPath(); - try { - Files.move(current, rename); - } catch (IOException e) { - System.out.println("Failed to rename file "+digest); - e.printStackTrace(); } if (!extract) { -- cgit v1.2.3