HexRaysPyTools icon indicating copy to clipboard operation
HexRaysPyTools copied to clipboard

Change config file path

Open mrj0n3s opened this issue 5 years ago • 1 comments

I would recommend changing the default config location in settings.py from

CONFIG_FILE_PATH = os.path.join(idc.idadir(), 'cfg', 'HexRaysPyTools.cfg')

to

CONFIG_FILE_PATH = os.path.join(os.path.dirname(__file__), 'cfg', 'HexRaysPyTools.cfg')

This allows to store the plugin under %APPDATA%\Hex-Rays\IDA Pro\plugins , allowing switching IDA version without having to re-install/moving around files. Note that the change expects a cfg folder to be present inside the HexRaysPyTools folder. This breaks the convention of keeping the cfg inside the cfg folder but makes it easier to copy in between versions, especially with the increase of IDA releases(service packs)

mrj0n3s avatar Sep 18 '20 00:09 mrj0n3s

+1 on this. As if you don't run it in Administrator on Windows, it won't be able to write the config file!

On Windows the following works too:

diff --git a/HexRaysPyTools/settings.py b/HexRaysPyTools/settings.py
index 0b028b2..82dd5cd 100644
--- a/HexRaysPyTools/settings.py
+++ b/HexRaysPyTools/settings.py
@@ -8,7 +8,8 @@ except ImportError:
     # for python 2
     import ConfigParser as configparser

-CONFIG_FILE_PATH = os.path.join(idc.idadir(), 'cfg', 'HexRaysPyTools.cfg')
+CONFIG_FILE_PATH = os.path.join(os.getenv('APPDATA'), 'Hex-Rays', 'IDA Pro', 'cfg', 'HexRaysPyTools.cfg')

 DEBUG_MESSAGE_LEVEL = logging.INFO
 # Whether propagate names (Propagate name feature) through all names or only defaults like v11, a3, this, field_4

saidelike avatar Aug 31 '21 10:08 saidelike