From 74197ef7d957f4ef75cf0817e1a786d03cc73345 Mon Sep 17 00:00:00 2001 From: AndrexUni <93882347+AndrexUni@users.noreply.github.com> Date: Sat, 1 Oct 2022 17:51:17 +0530 Subject: [PATCH 1/4] Support for multiple URLs enabled --- .idea/.name | 1 + .idea/discord.xml | 7 +++++ .idea/runConfigurations.xml | 10 +++++++ src/Drifty_CLI.java | 56 ++++++++++++++++++++++--------------- 4 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/discord.xml create mode 100644 .idea/runConfigurations.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 000000000..6abf3d054 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Drifty_CLI.java \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 000000000..30bab2abb --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 000000000..797acea53 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/src/Drifty_CLI.java b/src/Drifty_CLI.java index a5fc98474..c5c495e98 100644 --- a/src/Drifty_CLI.java +++ b/src/Drifty_CLI.java @@ -21,35 +21,45 @@ public static void main(String[] args) { System.out.println(ANSI_PURPLE+"===================================================================="+ANSI_RESET); } flag = true; - System.out.print("Enter the link to the file : "); - String link = SC.next(); - SC.nextLine(); - System.out.print("Enter the filename (with file extension) : "); - String fName = SC.nextLine(); - while (true) { - System.out.print("Do you want to download the file in your default downloads folder? (Enter Y for yes and N for no) : "); - char default_folder = SC.nextLine().toLowerCase().charAt(0); - if (default_folder == 'y') { - downloadsFolder = DefaultDownloadFolderLocationFinder.findPath() + System.getProperty("file.separator"); - if (downloadsFolder == null) { - System.out.println("Failed to retrieve default download folder!"); - cl.log("ERROR", "Failed to retrieve default download folder!"); + while(true) { + System.out.print("Enter the link to the file : "); + String link = SC.next(); + SC.nextLine(); + System.out.print("Enter the filename (with file extension) : "); + String fName = SC.nextLine(); + while (true) { + System.out.print("Do you want to download the file in your default downloads folder? (Enter Y for yes and N for no) : "); + char default_folder = SC.nextLine().toLowerCase().charAt(0); + if (default_folder == 'y') { + downloadsFolder = DefaultDownloadFolderLocationFinder.findPath() + System.getProperty("file.separator"); + if (downloadsFolder == null) { + System.out.println("Failed to retrieve default download folder!"); + cl.log("ERROR", "Failed to retrieve default download folder!"); + enterDownloadsFolder(); + } else { + System.out.println("Default download folder detected : " + downloadsFolder); + cl.log("INFO", "Default download folder detected : " + downloadsFolder); + } + } else if (default_folder == 'n') { enterDownloadsFolder(); } else { - System.out.println("Default download folder detected : " + downloadsFolder); - cl.log("INFO", "Default download folder detected : " + downloadsFolder); + System.out.println("Invalid input!"); + cl.log("ERROR", "Invalid input"); + continue; } - } else if (default_folder == 'n') { - enterDownloadsFolder(); - } else { - System.out.println("Invalid input!"); - cl.log("ERROR", "Invalid input"); + break; + } + FileDownloader fDownload = new FileDownloader(link, fName, downloadsFolder); + fDownload.run(); + System.out.println("Press Q to Quit Or Press any Key to Continue"); + String quit = SC.nextLine(); + if(quit.equals("Q") || quit.equals("q")){ + break; + } + else { continue; } - break; } - FileDownloader fDownload = new FileDownloader(link, fName, downloadsFolder); - fDownload.run(); } private static void enterDownloadsFolder(){ From 1da76ca47586b8cab619676998fb1dd604244166 Mon Sep 17 00:00:00 2001 From: Saptarshi Sarkar Date: Sat, 1 Oct 2022 18:03:12 +0530 Subject: [PATCH 2/4] Delete .name --- .idea/.name | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .idea/.name diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 6abf3d054..000000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -Drifty_CLI.java \ No newline at end of file From dbd61fc85e494b638a031167739e2034e21b0590 Mon Sep 17 00:00:00 2001 From: Saptarshi Sarkar Date: Sat, 1 Oct 2022 18:03:25 +0530 Subject: [PATCH 3/4] Delete discord.xml --- .idea/discord.xml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .idea/discord.xml diff --git a/.idea/discord.xml b/.idea/discord.xml deleted file mode 100644 index 30bab2abb..000000000 --- a/.idea/discord.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file From 4737b71f9bd747a8644722887d9e8bc1bca78f99 Mon Sep 17 00:00:00 2001 From: Saptarshi Sarkar Date: Sat, 1 Oct 2022 18:03:48 +0530 Subject: [PATCH 4/4] Delete runConfigurations.xml --- .idea/runConfigurations.xml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 .idea/runConfigurations.xml diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea53..000000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file