Skip to content

Commit e08763f

Browse files
committed
fix: check for path absolute-ness before resolving to a venv
logic for `getManimPath` is wrong #103
1 parent ca181d1 commit e08763f

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/sideview.ts

+19-14
Original file line numberDiff line numberDiff line change
@@ -283,23 +283,28 @@ export class ManimSideview {
283283

284284
private async getManimPath() {
285285
let manimPath = path.normalize(getUserConfiguration("defaultManimPath"));
286-
const env = await this.getPythonEnvironment();
287286
let envName = "";
288-
if (env) {
289-
envName = env.name || "base";
290-
Log.info(`Using python environment "${envName}" for manim.`);
291-
292-
let bin =
293-
PYTHON_ENV_SCRIPTS_FOLDER[process.platform as keyof typeof PYTHON_ENV_SCRIPTS_FOLDER];
294-
if (!bin) {
295-
Log.error(
296-
"Manim Sideview: Unsupported platform for python environment. Assuming linux directory."
297-
);
298-
bin = PYTHON_ENV_SCRIPTS_FOLDER["linux"];
299-
}
300287

301-
manimPath = path.join(env.folderUri.fsPath, bin, manimPath);
288+
if (!path.isAbsolute(manimPath)) {
289+
const env = await this.getPythonEnvironment();
290+
if (env) {
291+
envName = env.name || "base";
292+
Log.info(`Using python environment "${envName}" for manim.`);
293+
294+
let bin =
295+
PYTHON_ENV_SCRIPTS_FOLDER[process.platform as keyof typeof PYTHON_ENV_SCRIPTS_FOLDER];
296+
if (!bin) {
297+
Log.error(
298+
"Manim Sideview: Unsupported platform for python environment. Assuming linux directory."
299+
);
300+
bin = PYTHON_ENV_SCRIPTS_FOLDER["linux"];
301+
}
302+
303+
manimPath = path.join(env.folderUri.fsPath, bin, manimPath);
304+
Log.info(`Resolved manim path inside the venv ${env.folderUri.fsPath} + ${bin} + ${manimPath}`);
305+
}
302306
}
307+
303308
return { manim: manimPath, envName };
304309
}
305310

0 commit comments

Comments
 (0)