Skip to content

Commit 0a6ab19

Browse files
Check if project path exists before running Pixi commands (#17)
1 parent 8c2b4b4 commit 0a6ab19

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to the "pixi-code" extension will be documented in this file
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
- Check if project path exists before running Pixi commands
11+
812
## [0.1.3] - 2024-08-24
913

1014
### Added

src/pixi/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as ch from 'child_process';
2+
import * as fs from 'fs';
23
import { CancellationError, CancellationToken, Uri, window, workspace } from 'vscode';
34
import which from 'which';
45

@@ -87,6 +88,11 @@ export async function runPixi(args: string[], options?: ch.SpawnOptions, token?:
8788

8889
export async function refreshPixi(project_path: string): Promise<PixiEnvironment[]> {
8990
try {
91+
if (!fs.existsSync(project_path)) {
92+
traceVerbose(`Project path does not exist: ${project_path}`);
93+
return [];
94+
}
95+
9096
const pixi = await getPixi();
9197
const environments: PixiEnvironment[] = [];
9298

0 commit comments

Comments
 (0)