@volter/blender-engine 0.1.118 → 0.1.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/worker.ts +9 -2
- package/package.json +1 -1
package/browser/worker.ts
CHANGED
|
@@ -407,8 +407,15 @@ async function blenderIsServed(): Promise<{ available: boolean; missing: string[
|
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
|
|
410
|
+
/** The engine's filesystem is POSIX, so a Windows project root (`C:\Users\me\p`) is
|
|
411
|
+
* mounted at its URI path (`/C:/Users/me/p`); a POSIX root is its own mount. */
|
|
412
|
+
export function projectMount(project: string): string {
|
|
413
|
+
return /^[A-Za-z]:[\\/]/.test(project) ? `/${project.replaceAll('\\', '/')}` : project;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
async function start(hostProject: string, document?: string): Promise<unknown> {
|
|
411
417
|
if (session) throw new Error('The Blender session is already started');
|
|
418
|
+
const project = projectMount(hostProject);
|
|
412
419
|
if (!project.startsWith('/'))
|
|
413
420
|
throw new Error("The Blender session needs the project's absolute path");
|
|
414
421
|
// The document is the project's own file and is named the project's own way.
|
|
@@ -473,7 +480,7 @@ async function projectIndex(project: string): Promise<ProjectFile[] | null> {
|
|
|
473
480
|
return unreadable(String(error));
|
|
474
481
|
}
|
|
475
482
|
const { root, files } = payload;
|
|
476
|
-
if (root !== project)
|
|
483
|
+
if (projectMount(root) !== project)
|
|
477
484
|
say(
|
|
478
485
|
`The editor serving this tab has ${root} open, not ${project}; its files ` +
|
|
479
486
|
`are mounted at ${project}, which is where Python is looking.`,
|