Commit e0c06ce
committed
fix(compositor): bypass Electron's asar-transparent fs when probing for real asset files
`resolveSceneAssetPath`'s candidate-probe loop (from the previous commit) used
plain `fs.existsSync`, which Electron patches to read *through* an asar
archive — from JS's point of view, `.../app.asar/dist/wallpapers/x.jpg`
"exists". So the probe locked onto the VITE_PUBLIC candidate (pointing into
the asar) on every call and never reached the real `resourcesPath` files,
making the previous fix a no-op in the actual packaged app: rebuilt and
relaunched it, and the exact same "wallpaper image ... introuvable" errors
came right back.
Confirmed the mechanism by running a probe script inside the packaged binary
via `ELECTRON_RUN_AS_NODE=1`: patched `fs.existsSync` on the asar-internal
path answered `true`; the native addon (raw `fopen`/`CreateFile`, no
knowledge of asar) still gets ENOENT on that same path.
`original-fs` is Electron's own escape hatch for this — same API, unpatched.
Route the existence check through it, falling back to plain `fs` where
`original-fs` doesn't exist (outside Electron, i.e. the vitest suite), since
plain Node's `fs` was never patched in the first place there.
Re-verified live after rebuilding: the same project's bundled wallpaper and
themed cursor sprite now render in the packaged app, and the
"introuvable"/ENOENT log lines are gone.1 parent f7a020d commit e0c06ce
1 file changed
Lines changed: 24 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
35 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
36 | 51 | | |
37 | 52 | | |
38 | 53 | | |
| |||
64 | 79 | | |
65 | 80 | | |
66 | 81 | | |
67 | | - | |
| 82 | + | |
68 | 83 | | |
69 | 84 | | |
70 | 85 | | |
| |||
0 commit comments