Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple URLs enabled #21

Merged
merged 4 commits into from
Oct 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 33 additions & 23 deletions src/Drifty_CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down