File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
packages/php-wasm/node/src/lib Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { FSHelpers , type MountHandler } from '@php-wasm/universal' ;
2
2
import { statSync } from 'fs' ;
3
- import { basename } from 'path' ;
3
+ import { basename , dirname } from 'path' ;
4
4
5
5
export function createNodeFsMountHandler ( localPath : string ) : MountHandler {
6
6
return function ( php , FS , vfsMountPoint ) {
@@ -20,12 +20,14 @@ export function createNodeFsMountHandler(localPath: string): MountHandler {
20
20
let removeVfsNode = false ;
21
21
if ( ! FSHelpers . fileExists ( FS , vfsMountPoint ) ) {
22
22
if ( statSync ( localPath ) . isSymbolicLink ( ) ) {
23
+ FS . mkdirTree ( dirname ( vfsMountPoint ) ) ;
23
24
( FS as any ) . createNode (
24
25
FS . lookupPath ( vfsMountPoint , { parent : true } ) . node ,
25
26
basename ( localPath ) ,
26
27
110000
27
28
) ;
28
29
} else if ( statSync ( localPath ) . isFile ( ) ) {
30
+ FS . mkdirTree ( dirname ( vfsMountPoint ) ) ;
29
31
FS . writeFile ( vfsMountPoint , '' ) ;
30
32
} else if ( statSync ( localPath ) . isDirectory ( ) ) {
31
33
FS . mkdirTree ( vfsMountPoint ) ;
You can’t perform that action at this time.
0 commit comments