Skip to content

Commit

Permalink
fix package resource paths
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Sep 11, 2020
1 parent cc5e774 commit 2ff59e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 5 additions & 1 deletion fa/fainterp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time

import pkg_resources
from tkinter import ttk, Tk
from configparser import ConfigParser

Expand Down Expand Up @@ -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('=')
Expand Down
16 changes: 10 additions & 6 deletions fa/ida_plugin.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 2ff59e4

Please sign in to comment.