mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 08:34:17 +02:00
[api] refactoring: caching directory for root user is now /var/cache/bauh
This commit is contained in:
@@ -146,7 +146,7 @@ class SoftwarePackage(ABC):
|
||||
"""
|
||||
:return: base cache path for the specific app type
|
||||
"""
|
||||
return CACHE_PATH + '/' + self.get_type()
|
||||
return f'{CACHE_PATH}/{self.get_type()}'
|
||||
|
||||
def can_be_updated(self) -> bool:
|
||||
"""
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from pathlib import Path
|
||||
|
||||
from bauh import __app_name__
|
||||
from bauh.api import user
|
||||
|
||||
CACHE_PATH = '{}/.cache/bauh'.format(str(Path.home()))
|
||||
CACHE_PATH = f'/var/cache/{__app_name__}' if user.is_root() else f'{Path.home()}/.cache/{__app_name__}'
|
||||
CONFIG_PATH = '{}/.config/bauh'.format(str(Path.home()))
|
||||
USER_THEMES_PATH = '{}/.local/share/bauh/themes'.format(str(Path.home()))
|
||||
DESKTOP_ENTRIES_DIR = '{}/.local/share/applications'.format(str(Path.home()))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def is_root():
|
||||
return os.getuid() == 0
|
||||
def is_root(user_id: Optional[int] = None):
|
||||
return user_id == 0 if user_id is not None else os.getuid() == 0
|
||||
|
||||
Reference in New Issue
Block a user