Skip to content

Commit 8a333e7

Browse files
committed
refactor(NodeEmscripten): Always mount requested containing dirs
And throw an error with an attempt to mount root.
1 parent 7a8181d commit 8a333e7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/emscripten-module/itkJSPost.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
/** Given an absolute path to a file, mount its containing directory in the
22
* Emscripten virtual filesystem. Only relevant when within the Node.js
3-
* environment. If the containing directory already exists with the
4-
* Emscripten filesystem, it will not be mounted. */
3+
* environment. */
54
Module.mountContainingDir = function (filePath) {
65
if (!ENVIRONMENT_IS_NODE) {
76
return
87
}
98
var path = require('path')
109
var containingDir = path.dirname(filePath)
11-
// If the directory already exists, abort
12-
if (FS.isDir(containingDir) || containingDir === '/') {
13-
return
10+
// If the root, abort
11+
if (containingDir === '/') {
12+
throw new Error('Cannot mount root directory')
1413
}
1514

1615
var currentDir = '/'

0 commit comments

Comments
 (0)