Skip to content

Commit 7dd795c

Browse files
committed
fix(nix): guard AMENT_PREFIX_PATH against empty leading colon
Addresses Copilot review: when AMENT_PREFIX_PATH is unset/empty, the $AMENT_PREFIX_PATH:<paths> form injects a leading empty path segment, which tools that split on ':' interpret as the current directory. Use ${AMENT_PREFIX_PATH:+...} so the existing value (and its separator) is only prepended when non-empty.
1 parent 9cc34bf commit 7dd795c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@
340340
# Per-package AMENT_PREFIX_PATH: collapsed into one export so nix develop
341341
# doesn't evaluate 26 separate shell statements (each increments SHLVL).
342342
pkgs.lib.optionalString (rosEnvPaths != [ ]) ''
343-
export AMENT_PREFIX_PATH="$AMENT_PREFIX_PATH:${pkgs.lib.concatStringsSep ":" rosEnvPaths}"
343+
export AMENT_PREFIX_PATH="''${AMENT_PREFIX_PATH:+$AMENT_PREFIX_PATH:}${pkgs.lib.concatStringsSep ":" rosEnvPaths}"
344344
''
345345
}
346346

0 commit comments

Comments
 (0)