1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-06 13:56:34 +02:00

ripstatuscomplete java.nio

This commit is contained in:
soloturn
2022-01-03 19:39:16 +01:00
parent e3f6499840
commit 6c74922d6a
3 changed files with 10 additions and 16 deletions

View File

@@ -486,7 +486,7 @@ public abstract class AbstractRipper
completed = true; completed = true;
LOGGER.info(" Rip completed!"); LOGGER.info(" Rip completed!");
RipStatusComplete rsc = new RipStatusComplete(workingDir, getCount()); RipStatusComplete rsc = new RipStatusComplete(workingDir.toPath(), getCount());
RipStatusMessage msg = new RipStatusMessage(STATUS.RIP_COMPLETE, rsc); RipStatusMessage msg = new RipStatusMessage(STATUS.RIP_COMPLETE, rsc);
observer.update(this, msg); observer.update(this, msg);

View File

@@ -1440,8 +1440,8 @@ public final class MainWindow implements Runnable, RipStatusHandler {
statusProgress.setValue(0); statusProgress.setValue(0);
statusProgress.setVisible(false); statusProgress.setVisible(false);
openButton.setVisible(true); openButton.setVisible(true);
File f = rsc.dir; Path f = rsc.dir;
String prettyFile = Utils.shortenPath(f); String prettyFile = Utils.shortenPath(f.toFile());
openButton.setText(Utils.getLocalizedString("open") + prettyFile); openButton.setText(Utils.getLocalizedString("open") + prettyFile);
mainFrame.setTitle("RipMe v" + UpdateUtils.getThisJarVersion()); mainFrame.setTitle("RipMe v" + UpdateUtils.getThisJarVersion());
try { try {
@@ -1458,7 +1458,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
try { try {
String commandToRun = Utils.getConfigString("finish.command", "ls"); String commandToRun = Utils.getConfigString("finish.command", "ls");
commandToRun = commandToRun.replaceAll("%url%", url); commandToRun = commandToRun.replaceAll("%url%", url);
commandToRun = commandToRun.replaceAll("%path%", f.getAbsolutePath()); commandToRun = commandToRun.replaceAll("%path%", f.toAbsolutePath().toString());
LOGGER.info("RUnning command " + commandToRun); LOGGER.info("RUnning command " + commandToRun);
// code from: // code from:
// https://stackoverflow.com/questions/5711084/java-runtime-getruntime-getting-output-from-executing-a-command-line-program // https://stackoverflow.com/questions/5711084/java-runtime-getruntime-getting-output-from-executing-a-command-line-program
@@ -1484,7 +1484,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
LOGGER.error(e.getStackTrace()); LOGGER.error(e.getStackTrace());
} }
} }
appendLog("Rip complete, saved to " + f.getAbsolutePath(), Color.GREEN); appendLog("Rip complete, saved to " + f, Color.GREEN);
openButton.setActionCommand(f.toString()); openButton.setActionCommand(f.toString());
openButton.addActionListener(event -> { openButton.addActionListener(event -> {
try { try {

View File

@@ -1,29 +1,23 @@
package com.rarchives.ripme.ui; package com.rarchives.ripme.ui;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path;
public class RipStatusComplete { public class RipStatusComplete {
File dir = null; Path dir = null;
int count = 0; int count = 0;
public RipStatusComplete(File dir) { public RipStatusComplete(Path dir) {
this.dir = dir; this.dir = dir;
this.count = 1; this.count = 1;
} }
public RipStatusComplete(File dir, int count) { public RipStatusComplete(Path dir, int count) {
this.dir = dir; this.dir = dir;
this.count = count; this.count = count;
} }
public String getDir() { public String getDir() {
String result; return this.dir.toString();
try {
result = this.dir.getCanonicalPath();
} catch (IOException e) {
result = this.dir.toString();
}
return result;
} }
} }