GP-669: Fixing GhidraDev exception when ~/ghidra_scripts doesn't exist

This commit is contained in:
Ryan Kurtz 2021-02-08 13:02:32 -05:00
parent fef756c967
commit d9283b0b9d
5 changed files with 12 additions and 3 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<site> <site>
<feature url="features/ghidra.ghidradev_2.1.1.qualifier.jar" id="ghidra.ghidradev" version="2.1.1.qualifier"> <feature id="ghidra.ghidradev">
<category name="ghidra.ghidradev"/> <category name="ghidra.ghidradev"/>
</feature> </feature>
<category-def name="ghidra.ghidradev" label="Ghidra"/> <category-def name="ghidra.ghidradev" label="Ghidra"/>

View file

@ -2,7 +2,7 @@
<feature <feature
id="ghidra.ghidradev" id="ghidra.ghidradev"
label="GhidraDev" label="GhidraDev"
version="2.1.1.qualifier" version="2.1.2.qualifier"
provider-name="Ghidra"> provider-name="Ghidra">
<description> <description>

View file

@ -53,6 +53,8 @@ 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.2</b>:</u> Fixed exception that occurred when creating a new Ghidra scripting project
if a <i>~/ghidra_scripts</i> directory does not exist.</p>
<p><u><b>2.1.1</b>:</u> <p><u><b>2.1.1</b>:</u>
<ul> <ul>
<li> <li>

View file

@ -3,7 +3,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: GhidraDev Bundle-Name: GhidraDev
Bundle-SymbolicName: ghidra.ghidradev;singleton:=true Bundle-SymbolicName: ghidra.ghidradev;singleton:=true
Bundle-Version: 2.1.1.qualifier Bundle-Version: 2.1.2.qualifier
Bundle-Activator: ghidradev.Activator Bundle-Activator: ghidradev.Activator
Require-Bundle: org.eclipse.ant.core;bundle-version="3.5.200", Require-Bundle: org.eclipse.ant.core;bundle-version="3.5.200",
org.eclipse.buildship.core;bundle-version="3.0.0", org.eclipse.buildship.core;bundle-version="3.0.0",

View file

@ -25,6 +25,7 @@ import org.eclipse.jdt.core.*;
import ghidra.GhidraApplicationLayout; import ghidra.GhidraApplicationLayout;
import ghidra.framework.GModule; import ghidra.framework.GModule;
import ghidradev.Activator;
/** /**
* Utility methods for working with Ghidra scripts in Eclipse. * Utility methods for working with Ghidra scripts in Eclipse.
@ -87,6 +88,12 @@ public class GhidraScriptUtils {
// Link in the user's personal ghidra_scripts directory // Link in the user's personal ghidra_scripts directory
if (linkUserScripts) { if (linkUserScripts) {
if (!userScriptsDir.isDirectory()) {
if (!userScriptsDir.mkdirs()) {
throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
IStatus.ERROR, "Failed to create " + userScriptsDir, null));
}
}
IFolder link = javaProject.getProject().getFolder("Home scripts"); IFolder link = javaProject.getProject().getFolder("Home scripts");
link.createLink(new Path(userScriptsDir.getAbsolutePath()), IResource.NONE, monitor); link.createLink(new Path(userScriptsDir.getAbsolutePath()), IResource.NONE, monitor);
classpathEntries.add(JavaCore.newSourceEntry(link.getFullPath())); classpathEntries.add(JavaCore.newSourceEntry(link.getFullPath()));