1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

Added method for creating a path for caching in the /home directory

This commit is contained in:
Данила Скачедубов 2023-09-14 18:54:54 +04:00
parent 443b410dfa
commit d744cf8f6e

View File

@ -21,6 +21,7 @@ import pathlib
import os
from pathlib import Path
from urllib.parse import urlparse
from util.util import get_homedir
from .config import GPConfig
from .exceptions import NotUNCPathError
@ -67,12 +68,19 @@ def file_cache_dir():
Returns path pointing to gpupdate's cache directory
'''
cachedir = pathlib.Path('/var/cache/gpupdate_file_cache')
if not cachedir.exists():
cachedir.mkdir(parents=True, exist_ok=True)
return cachedir
def file_cache_path_home(username) -> str:
'''
Returns the path pointing to the gpupdate cache directory in the /home directory.
'''
cachedir = f'{get_homedir(username)}/.cache/gpupdate'
return cachedir
def local_policy_cache():
'''
Returns path to directory where lies local policy settings cache