Skip to content

Commit 80fc3e3

Browse files
committed
simplify path var
1 parent 239ce44 commit 80fc3e3

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/managers/builtin/venvManager.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,23 +187,23 @@ export class VenvManager implements EnvironmentManager {
187187
// Add .gitignore to the .venv folder
188188
try {
189189
// determine if env path is python binary or environment folder
190-
let envPath = environment.environmentPath;
190+
let envPath = environment.environmentPath.fsPath;
191191
try {
192-
const stat = await fs.stat(envPath.fsPath);
192+
const stat = await fs.stat(envPath);
193193
if (!stat.isDirectory()) {
194194
// If the env path is a file (likely the python binary), use parent-parent as the env path
195195
// following format of .venv/bin/python or .venv\Scripts\python.exe
196-
envPath = Uri.file(path.dirname(path.dirname(envPath.fsPath)));
196+
envPath = Uri.file(path.dirname(path.dirname(envPath))).fsPath;
197197
}
198198
} catch (err) {
199199
// If stat fails, fallback to original envPath
200200
traceWarn(
201-
`Failed to stat environment path: ${envPath.fsPath}. Error: ${
201+
`Failed to stat environment path: ${envPath}. Error: ${
202202
err instanceof Error ? err.message : String(err)
203203
}, continuing to attempt to create .gitignore.`,
204204
);
205205
}
206-
const gitignorePath = path.join(envPath.fsPath, '.gitignore');
206+
const gitignorePath = path.join(envPath, '.gitignore');
207207
await fs.writeFile(gitignorePath, '*\n', { flag: 'w' });
208208
} catch (err) {
209209
traceError(

0 commit comments

Comments
 (0)