@@ -182,7 +182,7 @@ __launchpad_setup_global_deps() {
182
182
__launchpad_update_library_paths "$global_env_dir"
183
183
fi
184
184
185
- # Also check for global dependencies from ~/.dotfiles
185
+ # Check for global dependencies from ~/.dotfiles (most common case)
186
186
local dotfiles_env_pattern="$HOME/.local/share/launchpad/.dotfiles_*"
187
187
for dotfiles_env in $dotfiles_env_pattern; do
188
188
if [[ -d "$dotfiles_env/bin" ]]; then
@@ -195,6 +195,39 @@ __launchpad_setup_global_deps() {
195
195
__launchpad_update_library_paths "$dotfiles_env"
196
196
fi
197
197
done
198
+
199
+ # Also check for any other manually activated global dependency environments
200
+ # Use launchpad to detect environments created with global: true flag
201
+ local launchpad_envs_dir="$HOME/.local/share/launchpad"
202
+ if [[ -d "$launchpad_envs_dir" ]] && command -v ${ launchpadBinary } >/dev/null 2>&1; then
203
+ # Get list of environments with global dependencies by checking for known patterns
204
+ # that indicate global installations (environments named after global dependency files)
205
+ for env_dir in "$launchpad_envs_dir"/*; do
206
+ # Skip if not a directory or if it's already processed above
207
+ if [[ ! -d "$env_dir" ]] || [[ "$env_dir" == *"/global"* ]] || [[ "$env_dir" == *"/.dotfiles_"* ]]; then
208
+ continue
209
+ fi
210
+
211
+ # Skip regular project environments (they have specific hashes)
212
+ local env_name=$(basename "$env_dir")
213
+ if [[ "$env_name" =~ ^launchpad_[a-f0-9]{8}$ ]]; then
214
+ continue
215
+ fi
216
+
217
+ # Include environments that match global dependency file patterns
218
+ # These would be created from running 'launchpad dev path/to/global-deps.yaml'
219
+ local bin_dir="$env_dir/bin"
220
+ if [[ -d "$bin_dir" ]] && [[ -n "$(ls -A "$bin_dir" 2>/dev/null)" ]]; then
221
+ # This is likely a global environment based on the naming pattern
222
+ # (non-project environments with actual binaries)
223
+ __launchpad_update_path "$bin_dir"
224
+ if [[ -d "$env_dir/sbin" ]]; then
225
+ __launchpad_update_path "$env_dir/sbin"
226
+ fi
227
+ __launchpad_update_library_paths "$env_dir"
228
+ fi
229
+ done
230
+ fi
198
231
}
199
232
200
233
# Ensure global dependencies are always in PATH
@@ -208,7 +241,7 @@ __launchpad_ensure_global_path() {
208
241
__launchpad_update_path "$global_env_dir/sbin"
209
242
fi
210
243
211
- # Also ensure global dependencies from ~/.dotfiles are in PATH
244
+ # Ensure global dependencies from ~/.dotfiles are in PATH
212
245
local dotfiles_env_pattern="$HOME/.local/share/launchpad/.dotfiles_*"
213
246
for dotfiles_env in $dotfiles_env_pattern; do
214
247
if [[ -d "$dotfiles_env/bin" ]]; then
@@ -219,6 +252,33 @@ __launchpad_ensure_global_path() {
219
252
fi
220
253
done
221
254
255
+ # Also ensure any other manually activated global environments are in PATH
256
+ local launchpad_envs_dir="$HOME/.local/share/launchpad"
257
+ if [[ -d "$launchpad_envs_dir" ]]; then
258
+ for env_dir in "$launchpad_envs_dir"/*; do
259
+ # Skip if not a directory or if it's already processed above
260
+ if [[ ! -d "$env_dir" ]] || [[ "$env_dir" == *"/global"* ]] || [[ "$env_dir" == *"/.dotfiles_"* ]]; then
261
+ continue
262
+ fi
263
+
264
+ # Skip regular project environments (they have specific hashes)
265
+ local env_name=$(basename "$env_dir")
266
+ if [[ "$env_name" =~ ^launchpad_[a-f0-9]{8}$ ]]; then
267
+ continue
268
+ fi
269
+
270
+ # Include environments that were created from global dependency files
271
+ local bin_dir="$env_dir/bin"
272
+ if [[ -d "$bin_dir" ]] && [[ -n "$(ls -A "$bin_dir" 2>/dev/null)" ]]; then
273
+ # This is likely a global environment based on the naming pattern
274
+ __launchpad_update_path "$bin_dir"
275
+ if [[ -d "$env_dir/sbin" ]]; then
276
+ __launchpad_update_path "$env_dir/sbin"
277
+ fi
278
+ fi
279
+ done
280
+ fi
281
+
222
282
# Always ensure critical system paths are available
223
283
__launchpad_ensure_system_path
224
284
}
0 commit comments