Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

refactor: update desktop platform adapter for EditorContext

esengine46ffd7dcf8bf
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index 6338feca5..a16d3e179 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -4,9 +4,9 @@
*/
import '@esengine/editor/styles';
-import { createEditor, ProjectLauncher, setPlatformAdapter, type Editor } from '@esengine/editor';
+import { createEditor, ProjectLauncher, setPlatformAdapter, setEditorContext, type Editor } from '@esengine/editor';
import { TauriPlatformAdapter } from './TauriPlatformAdapter';
-import { injectNativeFS } from './native-fs';
+import { nativeFS, nativeShell } from './native-fs';
import { invoke } from '@tauri-apps/api/core';
import type { App, ESEngineModule } from 'esengine';
@@ -88,8 +88,11 @@ async function openEditor(container: HTMLElement, projectPath: string): Promise<
async function init(): Promise<void> {
setPlatformAdapter(new TauriPlatformAdapter());
- injectNativeFS();
- (window as any).__esengine_invoke = invoke;
+ setEditorContext({
+ fs: nativeFS,
+ invoke,
+ shell: nativeShell,
+ });
const container = document.getElementById('editor-root');
if (!container) {