From bea6ea38aea2cf1f994bedf60daad2a038921412 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Thu, 7 Aug 2025 09:31:03 +0200 Subject: [PATCH] interactive client: change command history location - place file in ~/.local/state/ - create the directory if needed - use pathlib Change-Id: I9381c65fd63cea44013f2cfd16e14b8dc26c465c Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/37111 Tested-by: Jenkins Automated Tests Reviewed-by: Markus Zolliker --- frappy/client/interactive.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frappy/client/interactive.py b/frappy/client/interactive.py index ebc6e59b..2b604af3 100644 --- a/frappy/client/interactive.py +++ b/frappy/client/interactive.py @@ -29,7 +29,7 @@ import os import traceback import threading import logging -from os.path import expanduser +from pathlib import Path from frappy.lib import delayed_import from frappy.client import SecopClient, UnregisterCallback from frappy.errors import SECoPError @@ -497,7 +497,7 @@ class Console(code.InteractiveConsole): history = None if readline: try: - history = expanduser(f'~/.config/frappy/{name}-history') + history = Path(f'~/.local/state/frappy-{name}-history').expanduser() readline.read_history_file(history) except FileNotFoundError: pass @@ -505,6 +505,7 @@ class Console(code.InteractiveConsole): self.interact('', '') finally: if history: + history.parent.mkdir(mode=0o700, parents=True, exist_ok=True) readline.write_history_file(history) def raw_input(self, prompt=""):