aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/addons
diff options
context:
space:
mode:
authorHenrique <typoon@gmail.com>2019-11-25 08:56:44 -0500
committerHenrique <typoon@gmail.com>2019-11-25 08:56:44 -0500
commit0d29804ab852893e4e41c415de1ce3cc08ffcfae (patch)
tree45661a56df0b2845d6d38b96e579a1f804b1cb76 /mitmproxy/addons
parent6a7f27ff152fc05f9bbe847625e92dc1ecad3653 (diff)
downloadmitmproxy-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.py6
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()