Ghidra: Use getSourceFile to find Ghidra script location (#86)

`getAllScripts` was removed in a recent commit <2b49816c6c (diff-67260297e0f38cd74fe3ea2693266e52L555-L565)>

Use `getSourceFile` instead
This commit is contained in:
Camas
2020-10-02 04:05:19 +01:00
committed by Katy Coe
parent 2428060522
commit 3c1f4e9421

View File

@@ -71,5 +71,4 @@ def CustomInitializer():
currentProgram.setImageBase(toAddr(0), True) currentProgram.setImageBase(toAddr(0), True)
def GetScriptDirectory(): def GetScriptDirectory():
# Ghidra doesn't define __file__ so we have to iterate all the scripts return getSourceFile().getParentFile().toString()
return next(iter(filter(lambda x: x.getName() == '%SCRIPTFILENAME%', GhidraScriptUtil.getAllScripts())), None).getParentFile().toString()