add path checker

This commit is contained in:
2026-03-24 18:00:52 -07:00
parent 0ba4f34b18
commit 8d6f99699d

View File

@ -29,6 +29,8 @@ password_types = [
################################################# #################################################
HASH_FILE = Path("/opt/pwdgen/hash_record.txt") HASH_FILE = Path("/opt/pwdgen/hash_record.txt")
# Create the file if it doesn't exist # Create the file if it doesn't exist
os.makedirs(os.path.dirname(HASH_FILE), exist_ok=True)
if not HASH_FILE.exists(): if not HASH_FILE.exists():
HASH_FILE.touch(exist_ok=True) HASH_FILE.touch(exist_ok=True)