mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 08:51:05 -04:00
ghidra: normalize Windows executable path in exported TOML input (#92)
This commit is contained in:
committed by
GitHub
parent
ccd17e5244
commit
da10073cb9
@@ -120,6 +120,23 @@ public class ExportPS2Functions extends GhidraScript {
|
||||
return "\"" + value.replace("\\", "\\\\").replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
|
||||
// Ghidra on Windows can return executable paths like "/D:/path/to/elf".
|
||||
// TOML expects "D:/path/to/elf" for this field.
|
||||
private static String normalizeWindowsDrivePath(String value) {
|
||||
if (value == null || value.length() < 4) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value.charAt(0) == '/' &&
|
||||
Character.isLetter(value.charAt(1)) &&
|
||||
value.charAt(2) == ':' &&
|
||||
(value.charAt(3) == '/' || value.charAt(3) == '\\')) {
|
||||
return value.substring(1);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private static String normalizeOptionalLeadingUnderscore(String value) {
|
||||
if (value == null || value.isEmpty()) {
|
||||
return "";
|
||||
@@ -385,6 +402,7 @@ public class ExportPS2Functions extends GhidraScript {
|
||||
if (programPath == null) {
|
||||
programPath = "";
|
||||
}
|
||||
programPath = normalizeWindowsDrivePath(programPath);
|
||||
|
||||
File outputDir = tomlFile.getParentFile() == null ? new File("output") : new File(tomlFile.getParentFile(), "output");
|
||||
String ghidraCsvPath = (exportCsv && csvFile != null) ? csvFile.getAbsolutePath() : "";
|
||||
|
||||
Reference in New Issue
Block a user