(path)
| 2664 | var root = WORKERFS.createNode(null, '/', WORKERFS.DIR_MODE, 0); |
| 2665 | var createdParents = {}; |
| 2666 | function ensureParent(path) { |
| 2667 | // return the parent node, creating subdirs as necessary |
| 2668 | var parts = path.split('/'); |
| 2669 | var parent = root; |
| 2670 | for (var i = 0; i < parts.length-1; i++) { |
| 2671 | var curr = parts.slice(0, i+1).join('/'); |
| 2672 | // Issue 4254: Using curr as a node name will prevent the node |
| 2673 | // from being found in FS.nameTable when FS.open is called on |
| 2674 | // a path which holds a child of this node, |
| 2675 | // given that all FS functions assume node names |
| 2676 | // are just their corresponding parts within their given path, |
| 2677 | // rather than incremental aggregates which include their parent's |
| 2678 | // directories. |
| 2679 | if (!createdParents[curr]) { |
| 2680 | createdParents[curr] = WORKERFS.createNode(parent, parts[i], WORKERFS.DIR_MODE, 0); |
| 2681 | } |
| 2682 | parent = createdParents[curr]; |
| 2683 | } |
| 2684 | return parent; |
| 2685 | } |
| 2686 | function base(path) { |
| 2687 | var parts = path.split('/'); |
| 2688 | return parts[parts.length-1]; |
no outgoing calls
no test coverage detected
searching dependent graphs…