Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,11 @@ fn expand_host_path(path: &str, home: &Path, cwd: &Path) -> PathBuf {
fn defaults(options: &BaseOptions) -> io::Result<(PathBuf, PathBuf)> {
let home = match &options.home {
Some(home) => home.clone(),
None => PathBuf::from(std::env::var("HOME").unwrap_or_default()),
None => PathBuf::from(
std::env::var("HOME")
.or_else(|_| std::env::var("USERPROFILE"))
.unwrap_or_default(),
),
};
let cwd = match &options.cwd {
Some(cwd) => cwd.clone(),
Expand Down
5 changes: 3 additions & 2 deletions ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
stat,
writeFile,
} from "node:fs/promises";
import { homedir } from "node:os";
import { dirname, join, relative, resolve, sep } from "node:path";
import { fileURLToPath } from "node:url";
import { defaultHostsSpecJson } from "./hosts.generated.js";
Expand Down Expand Up @@ -415,7 +416,7 @@ export async function detectHosts(
options: BaseOptions & { scope?: Scope } = {},
): Promise<Host[]> {
const spec = await loadHostSpec(options.hostsFile);
const home = options.home ?? process.env.HOME ?? "";
const home = options.home ?? homedir();
const cwd = options.cwd ?? process.cwd();
const detected: Host[] = [];

Expand Down Expand Up @@ -678,7 +679,7 @@ export async function resolveInstallTargets(
detectedHostIds: string[];
}> {
const spec = await loadHostSpec(options.hostsFile);
const home = options.home ?? process.env.HOME ?? "";
const home = options.home ?? homedir();
Comment thread
samzong marked this conversation as resolved.
const cwd = options.cwd ?? process.cwd();
const agents = options.agents ?? defaultAgents;
const resolved =
Expand Down
Loading