(fs, p)
| 642 | * @returns {void} |
| 643 | */ |
| 644 | const mkdirpSync = (fs, p) => { |
| 645 | try { |
| 646 | fs.mkdirSync(p); |
| 647 | } catch (err) { |
| 648 | if (err) { |
| 649 | if (/** @type {NodeJS.ErrnoException} */ (err).code === "ENOENT") { |
| 650 | const dir = dirname(fs, p); |
| 651 | if (dir === p) { |
| 652 | throw err; |
| 653 | } |
| 654 | mkdirpSync(fs, dir); |
| 655 | fs.mkdirSync(p); |
| 656 | return; |
| 657 | } else if ( |
| 658 | /** @type {NodeJS.ErrnoException} */ (err).code === "EEXIST" || |
| 659 | /** @type {NodeJS.ErrnoException} */ (err).code === "EISDIR" |
| 660 | ) { |
| 661 | return; |
| 662 | } |
| 663 | throw err; |
| 664 | } |
| 665 | } |
| 666 | }; |
| 667 | |
| 668 | /** |
| 669 | * Processes the provided f. |
no test coverage detected