1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-01-17 12:48:24 +01: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;
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);
observer.update(this, msg);

View File

@ -1440,8 +1440,8 @@ public final class MainWindow implements Runnable, RipStatusHandler {
statusProgress.setValue(0);
statusProgress.setVisible(false);
openButton.setVisible(true);
File f = rsc.dir;
String prettyFile = Utils.shortenPath(f);
Path f = rsc.dir;
String prettyFile = Utils.shortenPath(f.toFile());
openButton.setText(Utils.getLocalizedString("open") + prettyFile);
mainFrame.setTitle("RipMe v" + UpdateUtils.getThisJarVersion());
try {
@ -1458,7 +1458,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
try {
String commandToRun = Utils.getConfigString("finish.command", "ls");
commandToRun = commandToRun.replaceAll("%url%", url);
commandToRun = commandToRun.replaceAll("%path%", f.getAbsolutePath());
commandToRun = commandToRun.replaceAll("%path%", f.toAbsolutePath().toString());
LOGGER.info("RUnning command " + commandToRun);
// code from:
// 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());
}
}
appendLog("Rip complete, saved to " + f.getAbsolutePath(), Color.GREEN);
appendLog("Rip complete, saved to " + f, Color.GREEN);
openButton.setActionCommand(f.toString());
openButton.addActionListener(event -> {
try {

View File

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