@@ -182,21 +182,7 @@ __launchpad_setup_global_deps() {
182
182
__launchpad_update_library_paths "$global_env_dir"
183
183
fi
184
184
185
- # Check for global dependencies from ~/.dotfiles (most common case)
186
- local dotfiles_env_pattern="$HOME/.local/share/launchpad/.dotfiles_*"
187
- for dotfiles_env in $dotfiles_env_pattern; do
188
- if [[ -d "$dotfiles_env/bin" ]]; then
189
- __launchpad_update_path "$dotfiles_env/bin"
190
- fi
191
- if [[ -d "$dotfiles_env/sbin" ]]; then
192
- __launchpad_update_path "$dotfiles_env/sbin"
193
- fi
194
- if [[ -d "$dotfiles_env" ]]; then
195
- __launchpad_update_library_paths "$dotfiles_env"
196
- fi
197
- done
198
-
199
- # Also check for any other manually activated global dependency environments
185
+ # First, check for any other manually activated global dependency environments
200
186
# Use launchpad to detect environments created with global: true flag
201
187
local launchpad_envs_dir="$HOME/.local/share/launchpad"
202
188
if [[ -d "$launchpad_envs_dir" ]] && command -v ${ launchpadBinary } >/dev/null 2>&1; then
@@ -228,6 +214,21 @@ __launchpad_setup_global_deps() {
228
214
fi
229
215
done
230
216
fi
217
+
218
+ # Then check for global dependencies from ~/.dotfiles (highest priority)
219
+ # These should come AFTER other global envs so they appear FIRST in PATH
220
+ local dotfiles_env_pattern="$HOME/.local/share/launchpad/.dotfiles_*"
221
+ for dotfiles_env in $dotfiles_env_pattern; do
222
+ if [[ -d "$dotfiles_env/bin" ]]; then
223
+ __launchpad_update_path "$dotfiles_env/bin"
224
+ fi
225
+ if [[ -d "$dotfiles_env/sbin" ]]; then
226
+ __launchpad_update_path "$dotfiles_env/sbin"
227
+ fi
228
+ if [[ -d "$dotfiles_env" ]]; then
229
+ __launchpad_update_library_paths "$dotfiles_env"
230
+ fi
231
+ done
231
232
}
232
233
233
234
# Ensure global dependencies are always in PATH
@@ -241,18 +242,7 @@ __launchpad_ensure_global_path() {
241
242
__launchpad_update_path "$global_env_dir/sbin"
242
243
fi
243
244
244
- # Ensure global dependencies from ~/.dotfiles are in PATH
245
- local dotfiles_env_pattern="$HOME/.local/share/launchpad/.dotfiles_*"
246
- for dotfiles_env in $dotfiles_env_pattern; do
247
- if [[ -d "$dotfiles_env/bin" ]]; then
248
- __launchpad_update_path "$dotfiles_env/bin"
249
- fi
250
- if [[ -d "$dotfiles_env/sbin" ]]; then
251
- __launchpad_update_path "$dotfiles_env/sbin"
252
- fi
253
- done
254
-
255
- # Also ensure any other manually activated global environments are in PATH
245
+ # First ensure any other manually activated global environments are in PATH
256
246
local launchpad_envs_dir="$HOME/.local/share/launchpad"
257
247
if [[ -d "$launchpad_envs_dir" ]]; then
258
248
for env_dir in "$launchpad_envs_dir"/*; do
@@ -279,6 +269,17 @@ __launchpad_ensure_global_path() {
279
269
done
280
270
fi
281
271
272
+ # Then ensure global dependencies from ~/.dotfiles are in PATH (highest priority)
273
+ local dotfiles_env_pattern="$HOME/.local/share/launchpad/.dotfiles_*"
274
+ for dotfiles_env in $dotfiles_env_pattern; do
275
+ if [[ -d "$dotfiles_env/bin" ]]; then
276
+ __launchpad_update_path "$dotfiles_env/bin"
277
+ fi
278
+ if [[ -d "$dotfiles_env/sbin" ]]; then
279
+ __launchpad_update_path "$dotfiles_env/sbin"
280
+ fi
281
+ done
282
+
282
283
# Always ensure critical system paths are available
283
284
__launchpad_ensure_system_path
284
285
}
0 commit comments