Ghidra is a software reverse engineering (SRE) framework
show bundle paths with variable substituted
Jason P. Leasured404e3f8dda8
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusComponentProvider.javaindex 4c506ac1db..6a4190d893 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusComponentProvider.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/osgi/BundleStatusComponentProvider.java@@ -33,6 +33,7 @@ import docking.widgets.filechooser.GhidraFileChooser;import docking.widgets.filechooser.GhidraFileChooserMode;import docking.widgets.table.*;import generic.jar.ResourceFile;+import generic.util.Path;import ghidra.app.services.ConsoleService;import ghidra.framework.plugintool.ComponentProviderAdapter;import ghidra.framework.plugintool.PluginTool;@@ -174,9 +175,10 @@ public class BundleStatusComponentProvider extends ComponentProviderAdapter {column.setCellRenderer(new GTableCellRenderer() {@Overridepublic Component getTableCellRendererComponent(GTableCellRenderingData data) {+ ResourceFile path = (ResourceFile) data.getValue();JLabel c = (JLabel) super.getTableCellRendererComponent(data);+ c.setText(Path.getPathAsString(path));- ResourceFile path = (ResourceFile) data.getValue();if (!path.exists()) {c.setForeground(Color.RED);}diff --git a/Ghidra/Framework/Generic/src/main/java/generic/util/Path.java b/Ghidra/Framework/Generic/src/main/java/generic/util/Path.javaindex 06fcdebec9..11371da3cb 100644--- a/Ghidra/Framework/Generic/src/main/java/generic/util/Path.java+++ b/Ghidra/Framework/Generic/src/main/java/generic/util/Path.java@@ -15,12 +15,12 @@*/package generic.util;+import java.io.File;+import generic.jar.ResourceFile;import ghidra.framework.Application;import ghidra.framework.OperatingSystem;-import java.io.File;-/*** A class to represent a PATH item.*/@@ -190,10 +190,11 @@ public class Path implements Comparable<Path> {/*** Returns the path as a string <b>with path element placeholders</b>, such as* {@link #GHIDRA_HOME}.+ * @param path the path** @return the path as a string .*/- public String getPathAsString() {+ static public String getPathAsString(ResourceFile path) {String userHome = System.getProperty("user.home");String absolutePath = path.getAbsolutePath();for (ResourceFile appRoot : Application.getApplicationRootDirectories()) {@@ -216,6 +217,16 @@ public class Path implements Comparable<Path> {return absolutePath.replace('\\', '/');}+ /**+ * Returns the path as a string <b>with path element placeholders</b>, such as+ * {@link #GHIDRA_HOME}.+ *+ * @return the path as a string .+ */+ public String getPathAsString() {+ return getPathAsString(path);+ }+/*** Returns true if the given path is a file inside of the current Ghidra application.* @return true if the given path is a file inside of the current Ghidra application.