(mountPoint: string)
| 112 | } |
| 113 | |
| 114 | public umount(mountPoint: string): void { |
| 115 | if (mountPoint[0] !== '/') { |
| 116 | mountPoint = `/${mountPoint}`; |
| 117 | } |
| 118 | mountPoint = path.resolve(mountPoint); |
| 119 | if (!this.mntMap[mountPoint]) { |
| 120 | throw new ApiError(ErrorCode.EINVAL, "Mount point " + mountPoint + " is already unmounted."); |
| 121 | } |
| 122 | delete this.mntMap[mountPoint]; |
| 123 | this.mountList.splice(this.mountList.indexOf(mountPoint), 1); |
| 124 | |
| 125 | while (mountPoint !== '/') { |
| 126 | if (this.rootFs.readdirSync(mountPoint).length === 0) { |
| 127 | this.rootFs.rmdirSync(mountPoint); |
| 128 | mountPoint = path.dirname(mountPoint); |
| 129 | } else { |
| 130 | break; |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * Returns the file system that the path points to. |
no test coverage detected