mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
parent
1a50107af7
commit
a70b2fad4c
1 changed files with 27 additions and 13 deletions
|
@ -62,20 +62,9 @@ public class ApplicationUtilities {
|
||||||
while (pathFile != null && pathFile.exists()) {
|
while (pathFile != null && pathFile.exists()) {
|
||||||
ResourceFile applicationPropertiesFile =
|
ResourceFile applicationPropertiesFile =
|
||||||
new ResourceFile(pathFile, ApplicationProperties.PROPERTY_FILE);
|
new ResourceFile(pathFile, ApplicationProperties.PROPERTY_FILE);
|
||||||
if (applicationPropertiesFile.exists()) {
|
if (validateApplicationPropertiesFile(applicationPropertiesFile)) {
|
||||||
try {
|
|
||||||
ApplicationProperties applicationProperties =
|
|
||||||
new ApplicationProperties(applicationPropertiesFile);
|
|
||||||
if (!applicationProperties.getApplicationName().isEmpty()) {
|
|
||||||
return pathFile;
|
return pathFile;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (IOException e2) {
|
|
||||||
Msg.error(ApplicationUtilities.class,
|
|
||||||
"Failed to read: " + applicationPropertiesFile, e2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pathFile = pathFile.getParentFile();
|
pathFile = pathFile.getParentFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +75,31 @@ public class ApplicationUtilities {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks to make sure the given application properties file exists and is a valid format
|
||||||
|
*
|
||||||
|
* @param applicationPropertiesFile The application properties file to validate
|
||||||
|
* @return true if the given application properties file exists and is a valid format;
|
||||||
|
* otherwise, false
|
||||||
|
*/
|
||||||
|
private static boolean validateApplicationPropertiesFile(
|
||||||
|
ResourceFile applicationPropertiesFile) {
|
||||||
|
if (applicationPropertiesFile.isFile()) {
|
||||||
|
try {
|
||||||
|
ApplicationProperties applicationProperties =
|
||||||
|
new ApplicationProperties(applicationPropertiesFile);
|
||||||
|
if (!applicationProperties.getApplicationName().isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
Msg.error(ApplicationUtilities.class,
|
||||||
|
"Failed to read: " + applicationPropertiesFile, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all application root directories defined in the repository config file.
|
* Finds all application root directories defined in the repository config file.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue