Skip to content

Commit 43f0137

Browse files
committed
chore: wip
1 parent df31e9a commit 43f0137

File tree

1 file changed

+62
-2
lines changed

1 file changed

+62
-2
lines changed

packages/launchpad/src/dev/shellcode.ts

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ __launchpad_setup_global_deps() {
182182
__launchpad_update_library_paths "$global_env_dir"
183183
fi
184184
185-
# Also check for global dependencies from ~/.dotfiles
185+
# Check for global dependencies from ~/.dotfiles (most common case)
186186
local dotfiles_env_pattern="$HOME/.local/share/launchpad/.dotfiles_*"
187187
for dotfiles_env in $dotfiles_env_pattern; do
188188
if [[ -d "$dotfiles_env/bin" ]]; then
@@ -195,6 +195,39 @@ __launchpad_setup_global_deps() {
195195
__launchpad_update_library_paths "$dotfiles_env"
196196
fi
197197
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
198231
}
199232
200233
# Ensure global dependencies are always in PATH
@@ -208,7 +241,7 @@ __launchpad_ensure_global_path() {
208241
__launchpad_update_path "$global_env_dir/sbin"
209242
fi
210243
211-
# Also ensure global dependencies from ~/.dotfiles are in PATH
244+
# Ensure global dependencies from ~/.dotfiles are in PATH
212245
local dotfiles_env_pattern="$HOME/.local/share/launchpad/.dotfiles_*"
213246
for dotfiles_env in $dotfiles_env_pattern; do
214247
if [[ -d "$dotfiles_env/bin" ]]; then
@@ -219,6 +252,33 @@ __launchpad_ensure_global_path() {
219252
fi
220253
done
221254
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+
222282
# Always ensure critical system paths are available
223283
__launchpad_ensure_system_path
224284
}

0 commit comments

Comments
 (0)