aboutsummaryrefslogtreecommitdiff
path: root/src/er_xdg_pipe_menu_scanner.erl
diff options
context:
space:
mode:
authorChristopher R. Nelson <christopher.nelson@languidnights.com>2026-07-21 11:44:41 -0400
committerChristopher R. Nelson <christopher.nelson@languidnights.com>2026-07-21 11:44:41 -0400
commit5ff1fbe175af17fbb808c5ea942f465a932da3af (patch)
treeb6a26b4b7e896e5ed5d85a5003c4d176ed5c8e9e /src/er_xdg_pipe_menu_scanner.erl
parent7e8472e1e2a0b39746ef86c041d56b92bab5a6b7 (diff)
Rename app from er_xdg_pipe_menu to xdg_pipe_menuHEADmain
Drop the "er-" prefix throughout: module/atom names, filenames, socket paths, and docs. It was an implementation detail, not part of the app's identity. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'src/er_xdg_pipe_menu_scanner.erl')
-rw-r--r--src/er_xdg_pipe_menu_scanner.erl62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/er_xdg_pipe_menu_scanner.erl b/src/er_xdg_pipe_menu_scanner.erl
deleted file mode 100644
index 131b4f6..0000000
--- a/src/er_xdg_pipe_menu_scanner.erl
+++ /dev/null
@@ -1,62 +0,0 @@
-%%%-------------------------------------------------------------------
-%% @doc Locates .desktop files under the XDG application directories.
-%%
-%% Directory precedence follows the XDG Base Directory Specification:
-%% the user's data home (most specific, so its entries should win over
-%% system ones downstream) is searched first, then each directory in
-%% `XDG_DATA_DIRS'. Each of `XDG_DATA_HOME' and `XDG_DATA_DIRS' falls
-%% back to its spec-defined default independently when unset or empty
-%% -- so a Flatpak-aware `XDG_DATA_DIRS' (which typically adds
-%% `~/.local/share/flatpak/exports/share') is honored in place of the
-%% default rather than merged with it.
-%% @end
-%%%-------------------------------------------------------------------
-
--module(er_xdg_pipe_menu_scanner).
-
--export([data_dirs/0, find_desktop_files/0, find_desktop_files/1]).
-
--define(DEFAULT_DATA_DIRS, ["/usr/local/share", "/usr/share"]).
-
--spec data_dirs() -> [file:filename_all()].
-data_dirs() ->
- [filename:join(Dir, "applications") || Dir <- data_home() ++ data_dirs_list()].
-
--spec find_desktop_files() -> [file:filename_all()].
-find_desktop_files() ->
- find_desktop_files(data_dirs()).
-
--spec find_desktop_files([file:filename_all()]) -> [file:filename_all()].
-find_desktop_files(Dirs) ->
- lists:flatmap(fun find_in_dir/1, Dirs).
-
-find_in_dir(Dir) ->
- case filelib:is_dir(Dir) of
- true -> filelib:wildcard(filename:join(Dir, "**/*.desktop"));
- false -> []
- end.
-
-data_home() ->
- case env("XDG_DATA_HOME") of
- undefined ->
- case env("HOME") of
- undefined -> [];
- Home -> [filename:join([Home, ".local", "share"])]
- end;
- Dir ->
- [Dir]
- end.
-
-data_dirs_list() ->
- case env("XDG_DATA_DIRS") of
- undefined -> ?DEFAULT_DATA_DIRS;
- Value -> [D || D <- string:split(Value, ":", all), D =/= ""]
- end.
-
-%% The spec treats an unset and an empty variable the same way.
-env(Name) ->
- case os:getenv(Name) of
- false -> undefined;
- "" -> undefined;
- Value -> Value
- end.