mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-13 04:05:04 +03:00
feat: add backend Mac support (#913)
Adds a Mac localplatform based on the Linux one Signed-off-by: Gianni Spadoni <me@gio.blue>
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
import platform, os
|
||||
|
||||
ON_WINDOWS = platform.system() == "Windows"
|
||||
ON_LINUX = not ON_WINDOWS
|
||||
ON_MAC = platform.system() == "Darwin"
|
||||
ON_LINUX = not ON_WINDOWS and not ON_MAC
|
||||
|
||||
if ON_WINDOWS:
|
||||
from .localplatformwin import *
|
||||
from . import localplatformwin as localplatform
|
||||
elif ON_MAC:
|
||||
from .localplatformmac import *
|
||||
from . import localplatformmac as localplatform
|
||||
else:
|
||||
from .localplatformlinux import *
|
||||
from . import localplatformlinux as localplatform
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
from ..enums import UserType
|
||||
import os, sys
|
||||
from . import localplatformlinux
|
||||
|
||||
# this should be public
|
||||
def _get_effective_user_id() -> int:
|
||||
return os.geteuid()
|
||||
|
||||
def chown(path : str, user : UserType = UserType.HOST_USER, recursive : bool = True) -> bool:
|
||||
return localplatformlinux.chown(path, user, recursive)
|
||||
|
||||
def chmod(path : str, permissions : int, recursive : bool = True) -> bool:
|
||||
return localplatformlinux.chmod(path, permissions, recursive)
|
||||
|
||||
def file_owner(path : str) -> UserType|None:
|
||||
return localplatformlinux.file_owner(path)
|
||||
|
||||
def get_home_path(user : UserType = UserType.HOST_USER) -> str:
|
||||
return localplatformlinux.get_home_path(user)
|
||||
|
||||
def setgid(user : UserType = UserType.HOST_USER):
|
||||
return localplatformlinux.setgid(user)
|
||||
|
||||
def setuid(user : UserType = UserType.HOST_USER):
|
||||
return localplatformlinux.setuid(user)
|
||||
|
||||
async def service_active(service_name : str) -> bool:
|
||||
return True # Stubbed
|
||||
|
||||
async def service_stop(service_name : str) -> bool:
|
||||
return True # Stubbed
|
||||
|
||||
async def service_start(service_name : str) -> bool:
|
||||
return True # Stubbed
|
||||
|
||||
async def service_restart(service_name : str, block : bool = True) -> bool:
|
||||
return True # Stubbed
|
||||
|
||||
def get_effective_username() -> str:
|
||||
return localplatformlinux.get_effective_username()
|
||||
|
||||
def get_username() -> str:
|
||||
return localplatformlinux.get_username()
|
||||
|
||||
def get_privileged_path() -> str:
|
||||
'''On Mac, privileged_path is equal to unprivileged_path'''
|
||||
return get_unprivileged_path()
|
||||
|
||||
def get_unprivileged_path() -> str:
|
||||
return localplatformlinux.get_unprivileged_path()
|
||||
|
||||
def get_unprivileged_user() -> str:
|
||||
return localplatformlinux.get_unprivileged_user()
|
||||
|
||||
async def restart_webhelper() -> bool:
|
||||
return await localplatformlinux.restart_webhelper()
|
||||
|
||||
async def close_cef_socket():
|
||||
return # Stubbed
|
||||
Reference in New Issue
Block a user