mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 13:10:33 +00:00
56 lines
1.8 KiB
Diff
56 lines
1.8 KiB
Diff
From 86cc27022015697a61d1ec1b13e52f9dbe7f6c57 Mon Sep 17 00:00:00 2001
|
|
From: worldofpeace <worldofpeace@protonmail.ch>
|
|
Date: Mon, 23 Mar 2020 18:34:00 -0400
|
|
Subject: [PATCH] Adjust get_data_path for NixOS
|
|
|
|
We construct the ulauncher data path from xdg_data_dirs
|
|
and prevent it from being a nix store path or being xdg_data_home.
|
|
We do this to prevent /nix/store paths being hardcoded to shortcuts.json.
|
|
On NixOS this path will either be /run/current-system/sw/share/ulauncher
|
|
or $HOME/.nix-profile/share/ulauncher if the user used nix-env.
|
|
---
|
|
ulauncher/config.py | 27 ++++++++++++++++++---------
|
|
1 file changed, 18 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/ulauncher/config.py b/ulauncher/config.py
|
|
index f21014e..cc636e1 100644
|
|
--- a/ulauncher/config.py
|
|
+++ b/ulauncher/config.py
|
|
@@ -50,15 +50,24 @@ def get_data_path():
|
|
is specified at installation time.
|
|
"""
|
|
|
|
- # Get pathname absolute or relative.
|
|
- path = os.path.join(
|
|
- os.path.dirname(__file__), __ulauncher_data_directory__)
|
|
-
|
|
- abs_data_path = os.path.abspath(path)
|
|
- if not os.path.exists(abs_data_path):
|
|
- raise ProjectPathNotFoundError(abs_data_path)
|
|
-
|
|
- return abs_data_path
|
|
+ paths = list(
|
|
+ filter(
|
|
+ os.path.exists,
|
|
+ [
|
|
+ os.path.join(dir, "ulauncher")
|
|
+ for dir in xdg_data_dirs
|
|
+ # Get path that isn't in the /nix/store so they don't get hardcoded into configs
|
|
+ if not dir.startswith("/nix/store/")
|
|
+ # Exclude .local/share/ulauncher which isn't what we want
|
|
+ if not dir.startswith(xdg_data_home)
|
|
+ ],
|
|
+ )
|
|
+ )
|
|
+
|
|
+ try:
|
|
+ return paths[0]
|
|
+ except:
|
|
+ raise ProjectPathNotFoundError()
|
|
|
|
|
|
def is_wayland():
|
|
--
|
|
2.25.1
|
|
|