GP-3852: Preventing installation of extension source directories

This commit is contained in:
dragonmacher 2023-09-20 18:01:14 -04:00
parent 0f7300aac0
commit b639053178
2 changed files with 23 additions and 15 deletions

View file

@ -166,6 +166,18 @@ public class ExtensionTableProvider extends DialogComponentProvider {
private boolean installExtensions(List<File> files) {
boolean didInstall = false;
for (File file : files) {
// A sanity check for users that try to install an extension from a source folder
// instead of a fully built extension.
if (new File(file, "build.gradle").isFile()) {
Msg.showWarn(this, null, "Invalid Extension", "The selected extension folder " +
"contains a 'build.gradle' file.\nGhidra does not support installing " +
"extensions in source form.\nPlease build the extension and install its zip " +
"file.");
didInstall = false;
continue;
}
boolean success = ExtensionUtils.install(file);
didInstall |= success;
}

View file

@ -515,10 +515,6 @@ public class ExtensionUtils {
if (file.isDirectory() && file.canRead()) {
File propertyFile = new File(file, PROPERTIES_FILE_NAME);
if (propertyFile.isFile()) {
if (new File(file, "build.gradle").isFile()) {
log.error("Extension source directories are not valid extensions");
return null;
}
return tryToLoadExtensionFromProperties(propertyFile);
}
}