Skip to content

Commit 48dd61e

Browse files
authored
feat: Add WasmShellEnableIDBFS support
1 parent 9d59f34 commit 48dd61e

File tree

5 files changed

+38
-3
lines changed

5 files changed

+38
-3
lines changed

doc/features-idbfs.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
uid: UnoWasmBootstrap.Features.idbfs
3+
---
4+
5+
# Support for IDBFS
6+
7+
In order to support emulated filesystem using [IDBFS](https://emscripten.org/docs/api_reference/Filesystem-API.html#filesystem-api-idbfs), add the following to your `.csproj`:
8+
9+
```xml
10+
<PropertyGroup>
11+
<WasmShellEnableIDBFS>true</WasmShellEnableIDBFS>
12+
</PropertyGroup>
13+
```
14+
15+
Note that this property is a shortcut to this equivalent configuration:
16+
17+
```xml
18+
<ItemGroup>
19+
<WasmShellExtraEmccFlags Include="-lidbfs.js" />
20+
<WasmShellEmccExportedRuntimeMethod Include="IDBFS" />
21+
</ItemGroup>
22+
```

doc/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ items:
2828
href: features-threading.md
2929
- name: Deep linking (routing)
3030
href: features-deep-linking.md
31+
- name: IDBFS Support
32+
href: features-idbfs.md
3133
- name: Pre-compression
3234
href: features-pre-compression.md
3335
- name: Embedded mode

doc/using-the-bootstrapper.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ By default, the .NET runtime does not load all resource assemblies, but if you w
104104
</PropertyGroup>
105105
```
106106

107+
### IDBFS
108+
109+
In version 8.x and earlier of the bootstrapper, IDBFS support was enabled by default.
110+
111+
Moving the .NET 9, the default interpreter runtime does not enable it by default. Read this documentation in order to [restore IDBFS support](xref:UnoWasmBootstrap.Features.idbfs).
112+
107113
### Interop
108114

109115
- `Module.mono_bind_static_method` is not available anymore, you'll need to use `Module.getAssemblyExports` instead.

src/Uno.Wasm.Bootstrap/build/Uno.Wasm.Bootstrap.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@
149149
BeforeTargets="ResolveStaticWebAssetsConfiguration">
150150

151151
<ItemGroup>
152+
<!-- IDBFS support -->
153+
<WasmShellExtraEmccFlags Condition=" '$(WasmShellEnableIDBFS)' == 'true' " Include="-lidbfs.js" />
154+
<WasmShellEmccExportedRuntimeMethod Condition=" '$(WasmShellEnableIDBFS)' == 'true' " Include="IDBFS" />
155+
152156
<!-- PInvoke compat -->
153157
<_WasmPInvokeModules Include="__Native" />
154158
<_WasmPInvokeModules Include="__Internal" />

src/Uno.Wasm.StaticLinking.Shared/Common.props

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
<WasmShellNativeCompile Include="$(MSBuildThisFileDirectory)test2.cpp" />
77
</ItemGroup>
88

9+
<PropertyGroup>
10+
<WasmShellEnableIDBFS>true</WasmShellEnableIDBFS>
11+
</PropertyGroup>
12+
913
<ItemGroup>
1014
<PackageReference Include="System.Web.Services.Description" Version="4.10.0" />
1115
</ItemGroup>
1216
<ItemGroup>
1317
<WasmShellEmccExportedRuntimeMethod Include="GL" />
14-
<WasmShellEmccExportedRuntimeMethod Include="IDBFS" />
1518
<WasmShellEmccExportedRuntimeMethod Include="FS" />
1619

1720
<!-- Based on https://github.com/dotnet/runtime/issues/76077#issuecomment-1260231545 -->
1821
<WasmShellExtraEmccFlags Include="-s LEGACY_GL_EMULATION=1" />
1922
<WasmShellExtraEmccFlags Include="-s USE_CLOSURE_COMPILER=1" />
20-
21-
<WasmShellExtraEmccFlags Include="-lidbfs.js" />
2223
</ItemGroup>
2324

2425
<ItemGroup Condition="'$(UseAOT)'=='true'">

0 commit comments

Comments
 (0)