From f8146fd493e9855c280659581cd97a37fe7a687c Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Sun, 30 Jun 2024 06:58:15 -0500 Subject: [PATCH] move .trim() for less redundancy --- src/Gonzo.java | 2 +- src/MissPiggy.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Gonzo.java b/src/Gonzo.java index d6e0b90..445f634 100644 --- a/src/Gonzo.java +++ b/src/Gonzo.java @@ -155,7 +155,7 @@ public class Gonzo { try { System.out.println("Firestar is extracting " + m.friendlyName + " by " + m.author); consoleDisplay.append("Firestar is extracting " + m.friendlyName + " by " + m.author + "\n"); - new ZipFile(System.getProperty("user.home") + "/.firestar/mods/" + m.path.trim()).extractAll(System.getProperty("user.home") + "/.firestar/temp/"); + new ZipFile(System.getProperty("user.home") + "/.firestar/mods/" + m.path).extractAll(System.getProperty("user.home") + "/.firestar/temp/"); if (new File(System.getProperty("user.home") + "/.firestar/temp/delete.txt").isFile()) { System.out.println("Firestar is deleting files that conflict with " + m.friendlyName + " by " + m.author); diff --git a/src/MissPiggy.java b/src/MissPiggy.java index 2be6a5f..8626bcd 100644 --- a/src/MissPiggy.java +++ b/src/MissPiggy.java @@ -198,13 +198,13 @@ public class MissPiggy implements ActionListener { mod.exists()) { //append mod to list from substring Main.Mod m = new Main().new Mod(); - m.path = s.substring(s.indexOf("=") + 1); + m.path = s.substring(s.indexOf("=") + 1).trim(); System.out.println("found file " + m.path); //get json metadata from zip comment JSONObject metadata; try { - metadata = new JSONObject(new ZipFile(System.getProperty("user.home") + "/.firestar/mods/" + m.path.trim()).getComment()); + metadata = new JSONObject(new ZipFile(System.getProperty("user.home") + "/.firestar/mods/" + m.path).getComment()); if (metadata.has("friendlyName")) {m.friendlyName = metadata.get("friendlyName").toString();} else {m.friendlyName = m.path;} if (metadata.has("description")) {m.description = metadata.get("description").toString();} if (metadata.has("version")) {m.version = Integer.parseInt(metadata.get("version").toString());} @@ -244,7 +244,7 @@ public class MissPiggy implements ActionListener { System.out.println("Initializing blacklist from file with length of " + bListArray.length + " units"); //debug for (String s : bListArray) { for (Main.Mod m : Main.Mods) { - if (s.trim().equals(m.path.trim())) { + if (s.trim().equals(m.path)) { m.enabled = false; } } @@ -474,7 +474,7 @@ public class MissPiggy implements ActionListener { try { //debug - File pathReference = new File(System.getProperty("user.home") + "/.firestar/mods/" + Main.Mods.get(modList.getSelectedIndex()).path.trim()); + File pathReference = new File(System.getProperty("user.home") + "/.firestar/mods/" + Main.Mods.get(modList.getSelectedIndex()).path); DecimalFormat df = new DecimalFormat("##.##"); df.setRoundingMode(RoundingMode.UP); float modFileSize = pathReference.length(); //precise units