mirror of
https://github.com/developersu/ns-usbloader.git
synced 2025-05-13 06:34:43 -04:00
parent
dfa29aebd3
commit
5838fe3b89
10 changed files with 330 additions and 41 deletions
|
@ -19,11 +19,8 @@
|
|||
package nsusbloader.cli;
|
||||
|
||||
import nsusbloader.NSLMain;
|
||||
import nsusbloader.Utilities.Rcm;
|
||||
import org.apache.commons.cli.*;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
public class CommandLineInterface {
|
||||
|
@ -49,7 +46,7 @@ public class CommandLineInterface {
|
|||
}
|
||||
if (cli.hasOption('r') || cli.hasOption("rcm")){
|
||||
final String payloadArgument = cli.getOptionValue("rcm");
|
||||
handleRcm(payloadArgument);
|
||||
new RcmCli(payloadArgument);
|
||||
return;
|
||||
}
|
||||
if (cli.hasOption("c") || cli.hasOption("clean")){
|
||||
|
@ -78,7 +75,6 @@ public class CommandLineInterface {
|
|||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
if (cli.hasOption("s") || cli.hasOption("split")){
|
||||
final String[] arguments = cli.getOptionValues("split");
|
||||
new Split(arguments);
|
||||
|
@ -208,23 +204,6 @@ public class CommandLineInterface {
|
|||
else
|
||||
System.out.println("There are no settings in system to remove");
|
||||
}
|
||||
private void handleRcm(String payload) throws InterruptedException{
|
||||
boolean isWindows = System.getProperty("os.name").toLowerCase().replace(" ", "").contains("windows");
|
||||
|
||||
if (isWindows) {
|
||||
if (! payload.matches("^.:\\\\.*$"))
|
||||
payload = System.getProperty("user.dir") + File.separator + payload;
|
||||
}
|
||||
else {
|
||||
if (! payload.startsWith("/"))
|
||||
payload = System.getProperty("user.dir") + File.separator + payload;
|
||||
}
|
||||
|
||||
Rcm rcm = new Rcm(payload);
|
||||
Thread rcmThread = new Thread(rcm);
|
||||
rcmThread.start();
|
||||
rcmThread.join();
|
||||
}
|
||||
private void handleHelp(Options cliOptions){
|
||||
new HelpFormatter().printHelp(
|
||||
120,
|
||||
|
|
28
src/main/java/nsusbloader/cli/RcmCli.java
Normal file
28
src/main/java/nsusbloader/cli/RcmCli.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package nsusbloader.cli;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class RcmCli {
|
||||
RcmCli(String argument) throws InterruptedException, IncorrectSetupException{
|
||||
runBackend(argument);
|
||||
}
|
||||
|
||||
private void runBackend(String payload) throws InterruptedException{
|
||||
/*
|
||||
boolean isWindows = System.getProperty("os.name").toLowerCase().replace(" ", "").contains("windows");
|
||||
|
||||
if (isWindows) {
|
||||
if (! payload.matches("^.:\\\\.*$"))
|
||||
payload = System.getProperty("user.dir") + File.separator + payload;
|
||||
}
|
||||
else {
|
||||
if (! payload.startsWith("/"))
|
||||
payload = System.getProperty("user.dir") + File.separator + payload;
|
||||
}
|
||||
*/
|
||||
nsusbloader.Utilities.Rcm rcm = new nsusbloader.Utilities.Rcm(payload);
|
||||
Thread rcmThread = new Thread(rcm);
|
||||
rcmThread.start();
|
||||
rcmThread.join();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue