Improved check that prevents Eclipse projects from being created within

the Ghidra installation directory

Closes #2298
This commit is contained in:
Ryan Kurtz 2020-09-24 08:43:07 -04:00 committed by dragonmacher
parent 0cdc722921
commit f3ba1ed000
2 changed files with 14 additions and 5 deletions

View file

@ -53,8 +53,16 @@ change with future releases.</p>
</ul> </ul>
<h2><a name="ChangeHistory"></a>Change History</h2> <h2><a name="ChangeHistory"></a>Change History</h2>
<p><u><b>2.1.1</b>:</u> Python debugging now works when PyDev is installed via the Eclipse "dropins" <p><u><b>2.1.1</b>:</u>
directory.</p> <ul>
<li>
Python debugging now works when PyDev is installed via the Eclipse "dropins" directory.
</li>
<li>
Fixed a bug in the check that prevents Ghidra projects from being created within the Ghidra
installation directory.
</li>
</ul>
<p><u><b>2.1.0</b>:</u> <p><u><b>2.1.0</b>:</u>
<ul> <ul>
<li> <li>

View file

@ -37,6 +37,7 @@ import ghidradev.EclipseMessageUtils;
import ghidradev.ghidraprojectcreator.utils.GhidraModuleUtils; import ghidradev.ghidraprojectcreator.utils.GhidraModuleUtils;
import ghidradev.ghidraprojectcreator.utils.GhidraModuleUtils.ModuleTemplateType; import ghidradev.ghidraprojectcreator.utils.GhidraModuleUtils.ModuleTemplateType;
import ghidradev.ghidraprojectcreator.wizards.pages.*; import ghidradev.ghidraprojectcreator.wizards.pages.*;
import utilities.util.FileUtilities;
/** /**
* Wizard to create a new Ghidra module project. * Wizard to create a new Ghidra module project.
@ -160,8 +161,8 @@ public class CreateGhidraModuleProjectWizard extends Wizard implements INewWizar
* @return True if the data returned from the wizard pages are valid; otherwise, false * @return True if the data returned from the wizard pages are valid; otherwise, false
*/ */
private boolean validate() { private boolean validate() {
if (projectPage.getProjectDir().getAbsolutePath().startsWith( if (FileUtilities.isPathContainedWithin(ghidraInstallationPage.getGhidraInstallDir(),
ghidraInstallationPage.getGhidraInstallDir().getAbsolutePath())) { projectPage.getProjectDir())) {
EclipseMessageUtils.showErrorDialog("Invalid Project Root Directory", EclipseMessageUtils.showErrorDialog("Invalid Project Root Directory",
"Project root directory cannot reside inside of the selected Ghidra installation directory."); "Project root directory cannot reside inside of the selected Ghidra installation directory.");
return false; return false;