(p: string)
| 245 | } |
| 246 | |
| 247 | public readdirSync(p: string): string[] { |
| 248 | const fsInfo = this._getFs(p); |
| 249 | |
| 250 | // If null, rootfs did not have the directory |
| 251 | // (or the target FS is the root fs). |
| 252 | let rv: string[] | null = null; |
| 253 | // Mount points are all defined in the root FS. |
| 254 | // Ensure that we list those, too. |
| 255 | if (fsInfo.fs !== this.rootFs) { |
| 256 | try { |
| 257 | rv = this.rootFs.readdirSync(p); |
| 258 | } catch (e) { |
| 259 | // Ignore. |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | try { |
| 264 | const rv2 = fsInfo.fs.readdirSync(fsInfo.path); |
| 265 | if (rv === null) { |
| 266 | return rv2; |
| 267 | } else { |
| 268 | // Filter out duplicates. |
| 269 | return rv2.concat(rv.filter((val) => rv2.indexOf(val) === -1)); |
| 270 | } |
| 271 | } catch (e) { |
| 272 | if (rv === null) { |
| 273 | throw this.standardizeError(e, fsInfo.path, p); |
| 274 | } else { |
| 275 | // The root FS had something. |
| 276 | return rv; |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | public readdir(p: string, cb: BFSCallback<string[]>): void { |
| 282 | const fsInfo = this._getFs(p); |
nothing calls this directly
no test coverage detected