From 34cc65535956944c84fa59e4ee56bc3a0d3bb1cb Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Sun, 13 Oct 2024 19:56:52 -0700 Subject: [PATCH 1/6] umu_consts: update standard paths for cache and runtime --- umu/umu_consts.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/umu/umu_consts.py b/umu/umu_consts.py index 59a20aecc..92ca34bdf 100644 --- a/umu/umu_consts.py +++ b/umu/umu_consts.py @@ -16,26 +16,14 @@ "getnativepath", } -# Installation path of the runtime files +# 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" - ) - if os.environ.get("container") == "flatpak" # noqa: SIM112 - else Path.home().joinpath(".local", "share", "umu") -) +UMU_LOCAL: Path = 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", - ) + Path(os.environ["XDG_CACHE_HOME"], "umu") if os.environ.get("container") == "flatpak" # noqa: SIM112 else Path.home().joinpath(".cache", "umu") ) From ed6d525e81772b23c6d9e1d64177029cb9989715 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:30:36 -0700 Subject: [PATCH 2/6] umu_consts: update umu standard paths - See https://github.com/Open-Wine-Components/umu-launcher/pull/229#discussion_r1799289068 --- umu/umu_consts.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/umu/umu_consts.py b/umu/umu_consts.py index 92ca34bdf..efe0be7d9 100644 --- a/umu/umu_consts.py +++ b/umu/umu_consts.py @@ -16,10 +16,25 @@ "getnativepath", } -# Installation path of the runtime files. -# Flatpak will be detected as outlined by systemd +XDG_DATA_HOME: Path = ( + Path(os.environ["XDG_DATA_HOME"]) + if os.environ.get("XDG_DATA_HOME") + else Path.home().joinpath(".local", "share") +) + +# Installation path of the runtime files that respects the XDG Base Directory +# Specification and Systemd container interface. # See https://systemd.io/CONTAINER_INTERFACE -UMU_LOCAL: Path = Path.home().joinpath(".local", "share", "umu") +# 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, 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 = ( + Path(os.environ.get("HOST_XDG_DATA_HOME", "XDG_DATA_HOME")).joinpath("umu") + if os.environ.get("container") == "flatpak" # noqa: SIM112 + else XDG_DATA_HOME.joinpath("umu") +) # Temporary directory for downloaded resources moved from tmpfs UMU_CACHE: Path = ( From fe63711b946d73081ef805280bbcbf4b6cac5e74 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:39:16 -0700 Subject: [PATCH 3/6] umu_consts: update cache path - Prefer conforming to the XDG Base Directory Specification when possible for our cache directory --- umu/umu_consts.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/umu/umu_consts.py b/umu/umu_consts.py index efe0be7d9..4c7f44ba9 100644 --- a/umu/umu_consts.py +++ b/umu/umu_consts.py @@ -22,6 +22,12 @@ else Path.home().joinpath(".local", "share") ) +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 @@ -40,7 +46,7 @@ UMU_CACHE: Path = ( Path(os.environ["XDG_CACHE_HOME"], "umu") if os.environ.get("container") == "flatpak" # noqa: SIM112 - else Path.home().joinpath(".cache", "umu") + else XDG_CACHE_HOME.joinpath("umu") ) # Constant defined in prctl.h From ad2ca93fd2a97c3d5e49db808d94ff7438c79019 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:32:58 -0700 Subject: [PATCH 4/6] umu_consts: fix umu standard paths --- umu/umu_consts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/umu/umu_consts.py b/umu/umu_consts.py index 4c7f44ba9..e18003c3c 100644 --- a/umu/umu_consts.py +++ b/umu/umu_consts.py @@ -28,6 +28,10 @@ else Path.home().joinpath(".cache") ) +_HOST_XDG_DATA_HOME: str = os.environ.get( + "HOST_XDG_DATA_HOME", os.environ["XDG_DATA_HOME"] +) + # Installation path of the runtime files that respects the XDG Base Directory # Specification and Systemd container interface. # See https://systemd.io/CONTAINER_INTERFACE @@ -37,7 +41,7 @@ # the permission 'xdg-data/umu:create'. # See https://github.com/Open-Wine-Components/umu-launcher/pull/229#discussion_r1799289068 UMU_LOCAL: Path = ( - Path(os.environ.get("HOST_XDG_DATA_HOME", "XDG_DATA_HOME")).joinpath("umu") + Path(_HOST_XDG_DATA_HOME).joinpath("umu") if os.environ.get("container") == "flatpak" # noqa: SIM112 else XDG_DATA_HOME.joinpath("umu") ) From 3dbdce36b20841b3662e6d04c59460b7d4343391 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Mon, 14 Oct 2024 12:16:02 -0700 Subject: [PATCH 5/6] umu_consts: update umu standard paths --- umu/umu_consts.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/umu/umu_consts.py b/umu/umu_consts.py index e18003c3c..c14d34560 100644 --- a/umu/umu_consts.py +++ b/umu/umu_consts.py @@ -17,9 +17,13 @@ } XDG_DATA_HOME: Path = ( - Path(os.environ["XDG_DATA_HOME"]) - if os.environ.get("XDG_DATA_HOME") - else Path.home().joinpath(".local", "share") + 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") + ) ) XDG_CACHE_HOME: Path = ( @@ -28,10 +32,6 @@ else Path.home().joinpath(".cache") ) -_HOST_XDG_DATA_HOME: str = os.environ.get( - "HOST_XDG_DATA_HOME", os.environ["XDG_DATA_HOME"] -) - # Installation path of the runtime files that respects the XDG Base Directory # Specification and Systemd container interface. # See https://systemd.io/CONTAINER_INTERFACE @@ -40,18 +40,10 @@ # then $XDG_DATA_HOME, 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 = ( - Path(_HOST_XDG_DATA_HOME).joinpath("umu") - if os.environ.get("container") == "flatpak" # noqa: SIM112 - else XDG_DATA_HOME.joinpath("umu") -) +UMU_LOCAL: Path = XDG_DATA_HOME.joinpath("umu") # Temporary directory for downloaded resources moved from tmpfs -UMU_CACHE: Path = ( - Path(os.environ["XDG_CACHE_HOME"], "umu") - if os.environ.get("container") == "flatpak" # noqa: SIM112 - else XDG_CACHE_HOME.joinpath("umu") -) +UMU_CACHE: Path = XDG_CACHE_HOME.joinpath("umu") # Constant defined in prctl.h # See prctl(2) for more details From 48c491881b3ee881b881832471dc8a3351472045 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Mon, 14 Oct 2024 12:19:13 -0700 Subject: [PATCH 6/6] umu_consts: update comment --- umu/umu_consts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/umu/umu_consts.py b/umu/umu_consts.py index c14d34560..cea5534cf 100644 --- a/umu/umu_consts.py +++ b/umu/umu_consts.py @@ -37,8 +37,8 @@ # 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, and will be required to update their manifests by adding -# the permission 'xdg-data/umu:create'. +# 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")