Merge remote-tracking branch 'origin/GP-3473_ryanmkurtz_snap'

This commit is contained in:
Ryan Kurtz
2023-09-14 12:43:29 -04:00
3 changed files with 25 additions and 10 deletions

View File

@@ -102,7 +102,7 @@ class EclipseConnectorTask extends Task {
Process process = null;
try {
ProcessBuilder processBuilder = createEclipseProcessBuilder(eclipseExecutableFile,
eclipseService.getEclipseWorkspaceDir());
eclipseService.getEclipseWorkspaceDir(), eclipseService.getEclipseDropinsDir());
processBuilder.redirectErrorStream(true);
processBuilder.directory(eclipseExecutableFile.getParentFile());
process = processBuilder.start();
@@ -163,10 +163,11 @@ class EclipseConnectorTask extends Task {
*
* @param eclipseExecutableFile The Eclipse executable file.
* @param eclipseWorkspaceDir The Eclipse workspace directory. Could be null.
* @param eclipseDropinsDir The eclipse dropins directory.
* @return A {@link ProcessBuilder} to launch Eclipse.
*/
private ProcessBuilder createEclipseProcessBuilder(File eclipseExecutableFile,
File eclipseWorkspaceDir) {
File eclipseWorkspaceDir, File eclipseDropinsDir) {
List<String> args = new ArrayList<>();
args.add(eclipseExecutableFile.getAbsolutePath());
@@ -178,6 +179,7 @@ class EclipseConnectorTask extends Task {
args.add("--launcher.appendVmargs");
args.add("-vmargs");
args.add("-Dghidra.install.dir=" + Application.getInstallationDirectory());
args.add("-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=" + eclipseDropinsDir);
// Eclipse on OS X can have file locking issues if the user home directory is networked.
// The following property is set in the launch script if we should disable file locking

View File

@@ -20,6 +20,8 @@ import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.apache.commons.lang3.SystemUtils;
import docking.options.OptionsService;
import docking.widgets.OptionDialog;
import generic.jar.ResourceFile;
@@ -110,7 +112,7 @@ public class EclipseIntegrationPlugin extends ProgramPlugin implements EclipseIn
if (mainFeaturesDir.isDirectory()) {
featuresDirs.add(mainFeaturesDir);
}
File dropinsDir = new File(eclipseInstallDir, "dropins");
File dropinsDir = getEclipseDropinsDir();
if (dropinsDir.isDirectory()) {
featuresDirs.add(dropinsDir);
for (File dir : dropinsDir.listFiles(File::isDirectory)) {
@@ -273,15 +275,17 @@ public class EclipseIntegrationPlugin extends ProgramPlugin implements EclipseIn
return eclipseInstallDir;
}
/**
* Gets the Eclipse dropins directory.
*
* @return The Eclipse dropins directory.
* @throws FileNotFoundException if the dropins directory does not exist.
*/
@Override
public File getEclipseDropinsDir() throws FileNotFoundException {
File eclipseInstallDir = getEclipseInstallDir();
File dropinsDir = new File(eclipseInstallDir, "dropins");
File dropinsDir;
if (eclipseInstallDir.getAbsolutePath().startsWith("/snap/eclipse")) {
dropinsDir = new File(SystemUtils.getUserHome(), "snap/eclipse/dropins");
}
else {
dropinsDir = new File(eclipseInstallDir, "dropins");
}
FileUtilities.mkdirs(dropinsDir);
if (!dropinsDir.isDirectory()) {
throw new FileNotFoundException("Eclipse dropins directory does not exist.");
}

View File

@@ -41,6 +41,15 @@ public interface EclipseIntegrationService {
*/
public File getEclipseExecutableFile() throws FileNotFoundException;
/**
* Gets the Eclipse dropins directory. If it doesn't exist, it will be created.
*
* @return The Eclipse dropins directory.
* @throws FileNotFoundException if the dropins directory was not found and could not be
* created.
*/
public File getEclipseDropinsDir() throws FileNotFoundException;
/**
* Gets the Eclipse workspace directory. If it is defined, the directory may or may not exist.
* If it is undefined, Eclipse will be in control of selecting a workspace directory to use.