diff --git a/fa/fainterp.py b/fa/fainterp.py index 25599a9..d7cd56f 100644 --- a/fa/fainterp.py +++ b/fa/fainterp.py @@ -1,5 +1,6 @@ import time +import pkg_resources from tkinter import ttk, Tk from configparser import ConfigParser @@ -323,7 +324,10 @@ def get_alias(self): :return: dictionary of all fa command aliases """ retval = {} - with open(os.path.join(COMMANDS_ROOT, 'alias')) as f: + + alias_res_path = os.path.join('commands', 'alias') + alias_filename = pkg_resources.resource_filename('fa', alias_res_path) + with open(alias_filename) as f: for line in f.readlines(): line = line.strip() k, v = line.split('=') diff --git a/fa/ida_plugin.py b/fa/ida_plugin.py index 635bd47..8cc68a9 100644 --- a/fa/ida_plugin.py +++ b/fa/ida_plugin.py @@ -1,10 +1,11 @@ -import binascii -import re -import traceback from collections import namedtuple +import pkg_resources import subprocess import tempfile +import traceback +import binascii import sys +import re import os sys.path.append('.') # noqa: E402 @@ -527,9 +528,12 @@ def update(self, ctx): act_icon = -1 if action.icon_filename: - icon_full_filename = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - 'res', 'icons', action.icon_filename) + icon_full_filename = \ + pkg_resources.resource_filename('fa', + os.path.join( + 'res', + 'icons', + action.icon_filename)) with open(icon_full_filename, 'rb') as f: icon_data = f.read() act_icon = ida_kernwin.load_custom_icon(data=icon_data, format="png")