Skip to content

Commit 77fb7f8

Browse files
fix: refine binary install detection logic in environment manager and update default binary locator
1 parent 8b0f83f commit 77fb7f8

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

src/environment/manager.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ export class EnvManager {
9393
const pythonExe = process.platform === 'win32' ? 'python.exe' : 'python';
9494
if (this.jacPath) {
9595
// Binary install: Python is embedded inside jac — no sibling python in bin/.
96-
// Applies to ~/.local/bin/jac (curl installer) and /usr/local/bin/jac.
97-
const isBinaryInstall =
98-
this.jacPath.includes(`${path.sep}.local${path.sep}bin${path.sep}`) ||
99-
this.jacPath === '/usr/local/bin/jac';
96+
// Applies to ~/.local/bin/jac (curl installer default location).
97+
const isBinaryInstall = this.jacPath.includes(`${path.sep}.local${path.sep}bin${path.sep}`);
10098
if (isBinaryInstall) { return pythonExe; }
10199

102100
// Legacy venv (pip install jaclang): python sits next to jac in bin/.

src/utils/envDetection.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,12 @@ async function walkForVenvs(baseDir: string, depth: number): Promise<string[]> {
6464

6565
// ── Environment Locators ─────────────────────────────────────────────────────
6666

67-
// Locator 0: Checks well-known binary install locations directly (no PATH dependency).
67+
// Locator 0: Checks ~/.local/bin/jac directly (no PATH dependency).
6868
// Catches the case where ~/.local/bin isn't on PATH yet (common right after install).
6969
async function findDefaultBinary(): Promise<string[]> {
70-
const homeDir = os.homedir();
71-
const isWin = process.platform === 'win32';
72-
const jacExe = isWin ? 'jac.exe' : 'jac';
73-
const candidates = isWin ? [] : [
74-
path.join(homeDir, '.local', 'bin', jacExe), // curl installer default
75-
'/usr/local/bin/jac', // manual / system-wide installs
76-
];
77-
const results = await Promise.all(candidates.map(async p => (await fileExists(p)) ? p : null));
78-
return results.filter((p): p is string => p !== null);
70+
if (process.platform === 'win32') return [];
71+
const jacPath = path.join(os.homedir(), '.local', 'bin', 'jac'); // Mac/Linux only — Windows returns early above
72+
return (await fileExists(jacPath)) ? [jacPath] : [];
7973
}
8074

8175
// Locator 1: Scans $PATH for jac

0 commit comments

Comments
 (0)