Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change config file path #65

Open
mrj0n3s opened this issue Sep 18, 2020 · 1 comment
Open

Change config file path #65

mrj0n3s opened this issue Sep 18, 2020 · 1 comment

Comments

@mrj0n3s
Copy link

mrj0n3s commented Sep 18, 2020

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)

@saidelike
Copy link

saidelike commented Aug 31, 2021

+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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants