refactor: replace glob with iterdir
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
1 parent
01deab7c64
commit
c1f600f539
2 files changed
+5
No files matched your search
@@ -13,6 +13,8 @@ from core.backup_manager import BACKUP_ROOT_DIR
|
||||
|
||||
MODULE_PATH = Path(__file__).resolve().parent
|
||||
|
||||
# names
|
||||
KLIPPER_LOG_NAME = "klippy.log"
|
||||
KLIPPER_DIR = Path.home().joinpath("klipper")
|
||||
KLIPPER_ENV_DIR = Path.home().joinpath("klippy-env")
|
||||
KLIPPER_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("klipper-backups")
|
||||
|
||||
@@ -158,5 +158,8 @@ class Klipper(BaseInstance):
|
||||
from utils.fs_utils import run_remove_routines
|
||||
|
||||
for log in list(self.log_dir.glob("klippy.log*")):
|
||||
files = self.log_dir.iterdir()
|
||||
logs = [f for f in files if f.name.startswith(KLIPPER_LOG_NAME)]
|
||||
for log in logs:
|
||||
Logger.print_status(f"Remove '{log}'")
|
||||
run_remove_routines(log)
|
||||
Reference in new issue
Block a user