mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-07-05 01:08:38 +00:00
GT-2865: ApplicationIdentifer now removes spaces from application name
and release name.
This commit is contained in:
parent
f9a1652974
commit
c5fdf6f9ec
|
@ -59,7 +59,7 @@ public class ApplicationIdentifierTest extends AbstractGenericTest {
|
|||
|
||||
@Test
|
||||
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");
|
||||
assertEquals(id1, id2);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ package ghidra.framework;
|
|||
* name version release name
|
||||
* </pre>
|
||||
* 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>
|
||||
* Examples:
|
||||
* <li>ghidra-7.4_DEV
|
||||
|
@ -44,14 +44,16 @@ public class ApplicationIdentifier {
|
|||
*/
|
||||
public ApplicationIdentifier(ApplicationProperties applicationProperties)
|
||||
throws IllegalArgumentException {
|
||||
applicationName = applicationProperties.getApplicationName().toLowerCase();
|
||||
applicationName =
|
||||
applicationProperties.getApplicationName().replaceAll("\\s", "").toLowerCase();
|
||||
if (applicationName.isEmpty()) {
|
||||
throw new IllegalArgumentException("Application name is undefined.");
|
||||
}
|
||||
|
||||
applicationVersion = new ApplicationVersion(applicationProperties.getApplicationVersion());
|
||||
|
||||
applicationReleaseName = applicationProperties.getApplicationReleaseName().toUpperCase();
|
||||
applicationReleaseName =
|
||||
applicationProperties.getApplicationReleaseName().replaceAll("\\s", "").toUpperCase();
|
||||
if (applicationReleaseName.isEmpty()) {
|
||||
throw new IllegalArgumentException("Application release name is undefined.");
|
||||
}
|
||||
|
@ -144,9 +146,9 @@ public class ApplicationIdentifier {
|
|||
|
||||
String[] identifierParts = identifier.split("_");
|
||||
if (identifierParts.length >= 3) {
|
||||
applicationName = identifierParts[0].toLowerCase();
|
||||
applicationName = identifierParts[0].replaceAll("\\s", "").toLowerCase();
|
||||
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
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -352,10 +352,11 @@ public class JavaConfig {
|
|||
}
|
||||
|
||||
// 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 +
|
||||
"_" + applicationReleaseName.toUpperCase();
|
||||
"_" + applicationReleaseName.replaceAll("\\s", "").toUpperCase();
|
||||
|
||||
if (isDev) {
|
||||
userSettingsDirName += "_location_" + installDir.getParentFile().getName();
|
||||
|
|
Loading…
Reference in New Issue
Block a user