Skip to content

Commit 12de818

Browse files
1 parent 458377b commit 12de818

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

Source/IPC/WindServiceHandler/Extension.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,28 @@ pub async fn handle_extensions_is_active(Runtime:Arc<ApplicationRunTime>, Args:V
140140
// the sidebar,
141141
// - logs one summary line under the `extensions` tag.
142142

143-
/// `~/.land/extensions` - matches the user-scope scan path in
144-
/// `Binary/Extension/ScanPathConfigure.rs` so VSIX-installed extensions
145-
/// appear on the next Mountain boot without a separate sync step.
143+
/// User-scope install destination for VSIX unpacks. Matches the user-scope
144+
/// scan path in `Binary/Extension/ScanPathConfigure.rs` so VSIX-installed
145+
/// extensions are discovered on the next Mountain boot without a sync step.
146+
///
147+
/// Atom V1: honours `LAND_USER_EXTENSIONS_DIR` (from `.env.Land.Extensions`).
148+
/// Resolution order:
149+
/// 1. `$LAND_USER_EXTENSIONS_DIR` — explicit per-operator override.
150+
/// Leading `~/` expands against `$HOME`.
151+
/// 2. `$HOME/.land/extensions` — VS Code-style user-scope default.
152+
/// 3. `./extensions` — fallback when `$HOME` is unavailable (container,
153+
/// restricted environment). `fs::create_dir_all` runs on install so
154+
/// this works even if the cwd is read-only at scan time.
146155
fn UserExtensionDirectory() -> PathBuf {
156+
if let Ok(Override) = std::env::var("LAND_USER_EXTENSIONS_DIR") {
157+
if let Some(Stripped) = Override.strip_prefix("~/") {
158+
if let Some(HomeDirectory) = dirs::home_dir() {
159+
return HomeDirectory.join(Stripped);
160+
}
161+
}
162+
return PathBuf::from(Override);
163+
}
164+
147165
if let Some(HomeDirectory) = dirs::home_dir() {
148166
return HomeDirectory.join(".land/extensions");
149167
}

0 commit comments

Comments
 (0)