diff options
| author | marios8543 <marios8543@gmail.com> | 2023-10-17 23:51:57 +0300 |
|---|---|---|
| committer | marios8543 <marios8543@gmail.com> | 2023-10-17 23:51:57 +0300 |
| commit | 36c145bb3a6e2e1c4026a4193620aec21959d684 (patch) | |
| tree | 1aecc2d77fd59308514b08d404b9f2dd4bb13c0b /backend/src/localplatform/localplatformwin.py | |
| parent | 19793d71e671a9888bf6e383c1e453620d9dd36d (diff) | |
| download | decky-loader-36c145bb3a6e2e1c4026a4193620aec21959d684.tar.gz decky-loader-36c145bb3a6e2e1c4026a4193620aec21959d684.zip | |
Add localplatform stuff to its own package
Diffstat (limited to 'backend/src/localplatform/localplatformwin.py')
| -rw-r--r-- | backend/src/localplatform/localplatformwin.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/backend/src/localplatform/localplatformwin.py b/backend/src/localplatform/localplatformwin.py new file mode 100644 index 00000000..4c4e9439 --- /dev/null +++ b/backend/src/localplatform/localplatformwin.py @@ -0,0 +1,53 @@ +from .customtypes import UserType +import os, sys + +def chown(path : str, user : UserType = UserType.HOST_USER, recursive : bool = True) -> bool: + return True # Stubbed + +def chmod(path : str, permissions : int, recursive : bool = True) -> bool: + return True # Stubbed + +def folder_owner(path : str) -> UserType|None: + return UserType.HOST_USER # Stubbed + +def get_home_path(user : UserType = UserType.HOST_USER) -> str: + return os.path.expanduser("~") # Mostly stubbed + +def setgid(user : UserType = UserType.HOST_USER): + pass # Stubbed + +def setuid(user : UserType = UserType.HOST_USER): + pass # Stubbed + +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) -> bool: + if service_name == "plugin_loader": + sys.exit(42) + + return True # Stubbed + +def get_username() -> str: + return os.getlogin() + +def get_privileged_path() -> str: + '''On windows, privileged_path is equal to unprivileged_path''' + return get_unprivileged_path() + +def get_unprivileged_path() -> str: + path = os.getenv("UNPRIVILEGED_PATH") + + if path == None: + path = os.getenv("PRIVILEGED_PATH", os.path.join(os.path.expanduser("~"), "homebrew")) + + return path + +def get_unprivileged_user() -> str: + return os.getenv("UNPRIVILEGED_USER", os.getlogin()) |
