Skip to content

Commit

Permalink
Revert "I think I fixed it"
Browse files Browse the repository at this point in the history
This reverts commit 10488f8.
  • Loading branch information
cdb84 committed Jan 6, 2021
1 parent 10488f8 commit 66521e0
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions client/src/main/java/client/AWSComboBoxListener.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package client;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -106,7 +105,7 @@ private void execAllOptions() {
allOptions.add(url);
}
String[] args = new String[allOptions.size()];
createProcess(allOptions.toArray(args));
createProcessBuilder(allOptions.toArray(args));
}

private String buildPathFor(String selectedValue) throws ValueNotFoundError {
Expand All @@ -124,9 +123,9 @@ private String buildPathFor(String selectedValue) throws ValueNotFoundError {
private void downloadFile(String presign, String outputName) {
String os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")) {
createProcess("curl.exe", "--output", outputName, "--url", presign);
createProcessBuilder("curl.exe", "--output", outputName, "--url", presign);
} else {
createProcess("wget", presign, "-O", outputName);
createProcessBuilder("wget", presign, "-O", outputName);
}
}

Expand Down Expand Up @@ -154,22 +153,24 @@ private void exec(String selectedValue) {
return;
}
String subtitlePresign = handler.generatePresignedUrlFromKey(subtitlePath).toString();
if (!subtitlePath.equals("")) {
if (!subtitlePath.equals("")){
downloadFile(subtitlePresign, fileName);
if (exec.contains("vlc")) {
createProcess(exec, presign, "--sub-file=" + fileName);
if (exec.contains("vlc")){
createProcessBuilder(exec, presign, "--sub-file="+fileName);
}
} else {
createProcess(exec, presign);
}
else{
createProcessBuilder(exec, presign);
}
}
}

private void createProcess(String... args) {
private void createProcessBuilder(String...args){
ProcessBuilder pb = new ProcessBuilder(args);
try {
Runtime.getRuntime().exec(args);
} catch (IOException e1) {
e1.printStackTrace();
pb.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}

0 comments on commit 66521e0

Please sign in to comment.