mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GT-2865: ApplicationIdentifer now removes spaces from application name
and release name.
This commit is contained in:
parent
f9a1652974
commit
c5fdf6f9ec
3 changed files with 11 additions and 8 deletions
|
@ -59,7 +59,7 @@ public class ApplicationIdentifierTest extends AbstractGenericTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testApplicationIdentifierEquals() {
|
public void testApplicationIdentifierEquals() {
|
||||||
ApplicationIdentifier id1 = new ApplicationIdentifier("ghidra_9.0_public");
|
ApplicationIdentifier id1 = new ApplicationIdentifier("ghi dra_9.0_pub lic");
|
||||||
ApplicationIdentifier id2 = new ApplicationIdentifier("Ghidra_9.0.0_PUBLIC");
|
ApplicationIdentifier id2 = new ApplicationIdentifier("Ghidra_9.0.0_PUBLIC");
|
||||||
assertEquals(id1, id2);
|
assertEquals(id1, id2);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ package ghidra.framework;
|
||||||
* name version release name
|
* name version release name
|
||||||
* </pre>
|
* </pre>
|
||||||
* Application names will be converted to all lowercase and application release names will be
|
* Application names will be converted to all lowercase and application release names will be
|
||||||
* converted to all uppercase.
|
* converted to all uppercase. Both will have spaces removed from their names.
|
||||||
* <p>
|
* <p>
|
||||||
* Examples:
|
* Examples:
|
||||||
* <li>ghidra-7.4_DEV
|
* <li>ghidra-7.4_DEV
|
||||||
|
@ -44,14 +44,16 @@ public class ApplicationIdentifier {
|
||||||
*/
|
*/
|
||||||
public ApplicationIdentifier(ApplicationProperties applicationProperties)
|
public ApplicationIdentifier(ApplicationProperties applicationProperties)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
applicationName = applicationProperties.getApplicationName().toLowerCase();
|
applicationName =
|
||||||
|
applicationProperties.getApplicationName().replaceAll("\\s", "").toLowerCase();
|
||||||
if (applicationName.isEmpty()) {
|
if (applicationName.isEmpty()) {
|
||||||
throw new IllegalArgumentException("Application name is undefined.");
|
throw new IllegalArgumentException("Application name is undefined.");
|
||||||
}
|
}
|
||||||
|
|
||||||
applicationVersion = new ApplicationVersion(applicationProperties.getApplicationVersion());
|
applicationVersion = new ApplicationVersion(applicationProperties.getApplicationVersion());
|
||||||
|
|
||||||
applicationReleaseName = applicationProperties.getApplicationReleaseName().toUpperCase();
|
applicationReleaseName =
|
||||||
|
applicationProperties.getApplicationReleaseName().replaceAll("\\s", "").toUpperCase();
|
||||||
if (applicationReleaseName.isEmpty()) {
|
if (applicationReleaseName.isEmpty()) {
|
||||||
throw new IllegalArgumentException("Application release name is undefined.");
|
throw new IllegalArgumentException("Application release name is undefined.");
|
||||||
}
|
}
|
||||||
|
@ -144,9 +146,9 @@ public class ApplicationIdentifier {
|
||||||
|
|
||||||
String[] identifierParts = identifier.split("_");
|
String[] identifierParts = identifier.split("_");
|
||||||
if (identifierParts.length >= 3) {
|
if (identifierParts.length >= 3) {
|
||||||
applicationName = identifierParts[0].toLowerCase();
|
applicationName = identifierParts[0].replaceAll("\\s", "").toLowerCase();
|
||||||
applicationVersion = new ApplicationVersion(identifierParts[1]);
|
applicationVersion = new ApplicationVersion(identifierParts[1]);
|
||||||
applicationReleaseName = identifierParts[2].toUpperCase();
|
applicationReleaseName = identifierParts[2].replaceAll("\\s", "").toUpperCase();
|
||||||
// Ignore any parts after the release name...they are not part of the identifier
|
// Ignore any parts after the release name...they are not part of the identifier
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -352,10 +352,11 @@ public class JavaConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the java home save file from user home directory (it might not exist yet).
|
// Get the java home save file from user home directory (it might not exist yet).
|
||||||
File userSettingsParentDir = new File(userHomeDir, "." + applicationName.toLowerCase());
|
File userSettingsParentDir =
|
||||||
|
new File(userHomeDir, "." + applicationName.replaceAll("\\s", "").toLowerCase());
|
||||||
|
|
||||||
String userSettingsDirName = userSettingsParentDir.getName() + "_" + applicationVersion +
|
String userSettingsDirName = userSettingsParentDir.getName() + "_" + applicationVersion +
|
||||||
"_" + applicationReleaseName.toUpperCase();
|
"_" + applicationReleaseName.replaceAll("\\s", "").toUpperCase();
|
||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
userSettingsDirName += "_location_" + installDir.getParentFile().getName();
|
userSettingsDirName += "_location_" + installDir.getParentFile().getName();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue