From aa2754df649fb2cbff9eed10c77a84b21f20455a Mon Sep 17 00:00:00 2001 From: Pierre GRASSER Date: Thu, 6 Jan 2022 11:42:19 +0100 Subject: [PATCH] Added forgotten switch to promptYesOrNo --- .../piorrro33/paktools/operation/Reconstruction.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/github/piorrro33/paktools/operation/Reconstruction.java b/src/main/java/com/github/piorrro33/paktools/operation/Reconstruction.java index b02aca2..f74b583 100644 --- a/src/main/java/com/github/piorrro33/paktools/operation/Reconstruction.java +++ b/src/main/java/com/github/piorrro33/paktools/operation/Reconstruction.java @@ -1,12 +1,13 @@ package com.github.piorrro33.paktools.operation; +import com.github.piorrro33.paktools.Utils; + import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.ByteChannel; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Scanner; import java.util.stream.Stream; import static com.github.piorrro33.paktools.Constants.*; @@ -27,10 +28,9 @@ public static boolean perform(Path pakPath, Path sourceFolderPath) { return false; } } else if (Files.exists(pakPath)) { - System.out.printf("Warning! The destination package file (%s) already exists.%n" + - "Do you want to overwrite it (yes or no)? ", pakPath.getFileName()); - final String userAnswer = new Scanner(System.in).nextLine(); - if (!userAnswer.equalsIgnoreCase("yes") && !userAnswer.equalsIgnoreCase("y")) { + String message = String.format("Warning! The destination package file (%s) already exists.%n" + + "Do you want to overwrite it (yes or no)? ", pakPath.getFileName()); + if (!Utils.promptYesOrNo(message)) { // User did not answer yes System.out.println("Aborting."); return false;