Skip to content

Commit

Permalink
Use relative paths in Process proc #3
Browse files Browse the repository at this point in the history
  • Loading branch information
SoyRA committed Jul 18, 2021
1 parent e39e525 commit 5c0da76
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
26 changes: 13 additions & 13 deletions PNLauncher/src/mainwindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -623,27 +623,27 @@ public void actionPerformed(ActionEvent e) {
case 1:
writeData.FileWD = readData.exeAppID[0];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[0], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[0], null);
break;
case 2:
writeData.FileWD = readData.exeAppID[2];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[2], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[2], null);
break;
case 3:
writeData.FileWD = readData.exeAppID[5];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[5], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[5], null);
break;
case 4:
writeData.FileWD = readData.exeAppID[7];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[7], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[7], null);
break;
case 5:
writeData.FileWD = readData.exeAppID[9];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[9], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[9], null);
break;
default:
break;
Expand Down Expand Up @@ -672,27 +672,27 @@ public void actionPerformed(ActionEvent e) {
case 1:
writeData.FileWD = readData.exeAppID[1];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[1], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[1], null);
break;
case 2:
writeData.FileWD = readData.exeAppID[4];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[4], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[4], null);
break;
case 3:
writeData.FileWD = readData.exeAppID[6];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[6], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[6], null);
break;
case 4:
writeData.FileWD = readData.exeAppID[8];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[8], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[8], null);
break;
case 5:
writeData.FileWD = readData.exeAppID[10];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[10], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[10], null);
break;
default:
break;
Expand Down Expand Up @@ -721,12 +721,12 @@ public void actionPerformed(ActionEvent e) {
case 2:
writeData.FileWD = readData.exeAppID[3];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[3], null, null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[3], null);
break;
case 4:
writeData.FileWD = readData.exeAppID[8];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[8], "+zombiesMode 1", null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[8], "+zombiesMode 1");
break;
default:
break;
Expand Down Expand Up @@ -755,7 +755,7 @@ public void actionPerformed(ActionEvent e) {
case 4:
writeData.FileWD = readData.exeAppID[8];
writeData.fileW();
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[8], "+survival 1", null);
writeData.procRun(readData.gameSel=cboSel, InjArch, readData.exeFile[8], "+survival 1");
break;
default:
break;
Expand Down
2 changes: 1 addition & 1 deletion PNLauncher/src/symlink.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class symlink {
*
* ****************************************************************/
private reader readData = new reader();
String GamePath, TargetPath = readData.getPath(), gameSel;
String GamePath, TargetPath = "./", gameSel;
private String lnexe = "Ayria/PNL/ln.exe", ExclFile = "Ayria/PNL/ExclFileList.txt", ExclFlr = "Ayria/PNL/ExclFlrList.txt", lnArgs = "--output Ayria/PNL/Logs/ln.exe.log -s -o";


Expand Down
13 changes: 3 additions & 10 deletions PNLauncher/src/writer.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,8 @@ public void iniW() {
* All this to create a process... ;-;!
*
* ****************************************************************/
public void procRun(int GameSel, String InjFile, String GameFile, String GameArgs, String GamePath) {
public void procRun(int GameSel, String InjFile, String GameFile, String GameArgs) {
readData.gameSel = GameSel;
if (readData.iniEF("Symlinks").equals("1")) {
InjFile = readData.getPath()+"\\"+InjFile;
GameFile = readData.getPath()+"\\"+GameFile;
GamePath = readData.getPath();
} else {
GamePath = readData.iniGP();
}
if (GameArgs == null) {
GameArgs = readData.iniGA();
} else {
Expand All @@ -79,8 +72,8 @@ public void procRun(int GameSel, String InjFile, String GameFile, String GameArg


try {
Process proc = Runtime.getRuntime().exec(new String[] {"CMD", "/C", InjFile, GameFile, GameArgs}, null, new File(GamePath)); // Runs the Injector##.exe with everything the user has typed in.
BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream())); // And this is just to read what Injector##.exe says.
Process proc = Runtime.getRuntime().exec(new String[] {"CMD", "/C", InjFile, GameFile, GameArgs}, null, new File("./")); // Runs the Injector##.exe with everything the user has typed in.
BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream())); // And this is just to read what Injector##.exe says.
String str = null;
System.out.println("\n---------------- " + InjFile.replaceAll("^[/\\\\\\\\]?(?:.+[/\\\\\\\\]+?)?(.+?)[/\\\\\\\\]?$", "$1") + " ----------------\n"); // All to say 32 or 64 . _ .
while ((str = stdInput.readLine()) != null) {
Expand Down

0 comments on commit 5c0da76

Please sign in to comment.