(basePath: string, ...segments: string[])
| 115 | } |
| 116 | |
| 117 | static joinPath(basePath: string, ...segments: string[]): string { |
| 118 | const normalizedSegments = this.normalizeSegments(segments); |
| 119 | |
| 120 | if (this.isWindowsBasePath(basePath)) { |
| 121 | const normalizedBasePath = path.win32.normalize(basePath); |
| 122 | return normalizedSegments.length |
| 123 | ? path.win32.join(normalizedBasePath, ...normalizedSegments) |
| 124 | : normalizedBasePath; |
| 125 | } |
| 126 | |
| 127 | const posixBasePath = basePath.replace(/\\/g, '/'); |
| 128 | |
| 129 | return normalizedSegments.length |
| 130 | ? path.posix.join(posixBasePath, ...normalizedSegments) |
| 131 | : path.posix.normalize(posixBasePath); |
| 132 | } |
| 133 | |
| 134 | static async createDirectory(dirPath: string): Promise<void> { |
| 135 | await fs.mkdir(dirPath, { recursive: true }); |
no test coverage detected