Skip to content

PHP: mount() should not create a directory when mounting a file #503

@adamziel

Description

@adamziel

The mount() method calls mkdirTree() internally to ensure the target path exists – otherwise Emscripten throws an error. The problem is, sometimes we want to mount a file and not a directory. In these cases, the mount() method will still create that empty dir:

mount(localPath: string | MountSettings, virtualFSPath: string) {
if (!this.fileExists(virtualFSPath)) {
this.mkdirTree(virtualFSPath);
}

Let's:

  • Add a check like !this.isDir(localPath)
  • Add a unit test in php-spec.ts to prevent regressions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions