mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-26 09:13:35 +05:00
refactor: replace glob with iterdir
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -13,6 +13,8 @@ from core.backup_manager import BACKUP_ROOT_DIR
|
|||||||
|
|
||||||
MODULE_PATH = Path(__file__).resolve().parent
|
MODULE_PATH = Path(__file__).resolve().parent
|
||||||
|
|
||||||
|
# names
|
||||||
|
KLIPPER_LOG_NAME = "klippy.log"
|
||||||
KLIPPER_DIR = Path.home().joinpath("klipper")
|
KLIPPER_DIR = Path.home().joinpath("klipper")
|
||||||
KLIPPER_ENV_DIR = Path.home().joinpath("klippy-env")
|
KLIPPER_ENV_DIR = Path.home().joinpath("klippy-env")
|
||||||
KLIPPER_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("klipper-backups")
|
KLIPPER_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("klipper-backups")
|
||||||
|
|||||||
@@ -158,5 +158,8 @@ class Klipper(BaseInstance):
|
|||||||
from utils.fs_utils import run_remove_routines
|
from utils.fs_utils import run_remove_routines
|
||||||
|
|
||||||
for log in list(self.log_dir.glob("klippy.log*")):
|
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}'")
|
Logger.print_status(f"Remove '{log}'")
|
||||||
run_remove_routines(log)
|
run_remove_routines(log)
|
||||||
|
|||||||
Reference in New Issue
Block a user