diff options
author | Henrique <typoon@gmail.com> | 2019-11-25 08:56:44 -0500 |
---|---|---|
committer | Henrique <typoon@gmail.com> | 2019-11-25 08:56:44 -0500 |
commit | 0d29804ab852893e4e41c415de1ce3cc08ffcfae (patch) | |
tree | 45661a56df0b2845d6d38b96e579a1f804b1cb76 /mitmproxy/addons | |
parent | 6a7f27ff152fc05f9bbe847625e92dc1ecad3653 (diff) | |
download | mitmproxy-0d29804ab852893e4e41c415de1ce3cc08ffcfae.tar.gz mitmproxy-0d29804ab852893e4e41c415de1ce3cc08ffcfae.tar.bz2 mitmproxy-0d29804ab852893e4e41c415de1ce3cc08ffcfae.zip |
Moved confdir check logic into the addon
Diffstat (limited to 'mitmproxy/addons')
-rw-r--r-- | mitmproxy/addons/command_history.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mitmproxy/addons/command_history.py b/mitmproxy/addons/command_history.py index 3df2fe5d..c66af2be 100644 --- a/mitmproxy/addons/command_history.py +++ b/mitmproxy/addons/command_history.py @@ -14,7 +14,11 @@ class CommandHistory: self.current_index: int = -1 self.filter_str: str = '' - _command_history_path = os.path.join(os.path.expanduser(ctx.options.confdir), 'command_history') + _command_history_dir = os.path.expanduser(ctx.options.confdir) + if not os.path.exists(_command_history_dir): + os.makedirs(_command_history_dir) + + _command_history_path = os.path.join(_command_history_dir, 'command_history') _history_lines: typing.List[str] = [] if os.path.exists(_command_history_path): _history_lines = open(_command_history_path, 'r').readlines() |