Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use $HOME/.local/share/umu and $XDG_CACHE_HOME for flatpak #229

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions umu/umu_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,35 @@
"getnativepath",
}

# Installation path of the runtime files
# Flatpak will be detected as outlined by systemd
# See https://systemd.io/CONTAINER_INTERFACE
UMU_LOCAL: Path = (
Path.home().joinpath(
".var", "app", "org.openwinecomponents.umu.umu-launcher", "data", "umu"
XDG_DATA_HOME: Path = (
Path(os.environ["HOST_XDG_DATA_HOME"])
if os.environ.get("HOST_XDG_DATA_HOME")
else (
Path(os.environ["XDG_DATA_HOME"])
if os.environ.get("XDG_DATA_HOME")
else Path.home().joinpath(".local", "share")
)
if os.environ.get("container") == "flatpak" # noqa: SIM112
else Path.home().joinpath(".local", "share", "umu")
)

# Temporary directory for downloaded resources moved from tmpfs
UMU_CACHE: Path = (
Path.home().joinpath(
".var",
"app",
"org.openwinecomponents.umu.umu-launcher",
"cache",
"umu",
)
if os.environ.get("container") == "flatpak" # noqa: SIM112
else Path.home().joinpath(".cache", "umu")
XDG_CACHE_HOME: Path = (
Path(os.environ["XDG_CACHE_HOME"])
if os.environ.get("XDG_CACHE_HOME")
else Path.home().joinpath(".cache")
)

# Installation path of the runtime files that respects the XDG Base Directory
# Specification and Systemd container interface.
# See https://systemd.io/CONTAINER_INTERFACE
# See https://specifications.freedesktop.org/basedir-spec/latest/index.html#basics
# NOTE: For Flatpaks, the runtime will be installed in $HOST_XDG_DATA_HOME
# then $XDG_DATA_HOME as fallback, and will be required to update their
# manifests by adding the permission 'xdg-data/umu:create'.
# See https://github.com/Open-Wine-Components/umu-launcher/pull/229#discussion_r1799289068
UMU_LOCAL: Path = XDG_DATA_HOME.joinpath("umu")

# Temporary directory for downloaded resources moved from tmpfs
UMU_CACHE: Path = XDG_CACHE_HOME.joinpath("umu")

# Constant defined in prctl.h
# See prctl(2) for more details
PR_SET_CHILD_SUBREAPER = 36
Loading