fix: guard unset HOME in desktop-entry cmake script and correct plan verification
Two code-review findings: 1. Add a guard in cmake/install_desktop_entry.cmake that fails visibly when both XDG_DATA_HOME and HOME are unset or empty, preventing silent installation to the filesystem root in minimal CI sandboxes. 2. Replace the plan's tail-based verification with grep, because cmake's FATAL_ERROR message and ninja's "build stopped" lines push the actual rejection message out of the last four lines. The grep command reliably finds the expected "desktop-file-validate rejected" string. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
a055325831
commit
f2978fe742
2 files changed
+10
-2
No files matched your search
@@ -16,6 +16,14 @@ else()
|
||||
set(data_home "$ENV{HOME}/.local/share")
|
||||
endif()
|
||||
|
||||
# Fail visibly if both fallback paths are unusable. The script needs a directory to install into;
|
||||
# a missing $HOME in a sandboxed CI environment should not silently install to the filesystem root.
|
||||
if(NOT DEFINED ENV{XDG_DATA_HOME} OR "$ENV{XDG_DATA_HOME}" STREQUAL "")
|
||||
if(NOT DEFINED ENV{HOME} OR "$ENV{HOME}" STREQUAL "")
|
||||
message(FATAL_ERROR "XDG_DATA_HOME and HOME are both unset or empty; cannot determine install directory")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(apps_dir "${data_home}/applications")
|
||||
set(icon_dir "${data_home}/icons/hicolor/scalable/apps")
|
||||
set(sym_dir "${data_home}/icons/hicolor/symbolic/apps")
|
||||
|
||||
Reference in new issue
Block a user