(dir: string, checkExisting = true)
| 9 | * @returns |
| 10 | */ |
| 11 | export function resolveWorkingDir(dir: string, checkExisting = true): string { |
| 12 | if (!dir) { |
| 13 | return process.cwd(); |
| 14 | } |
| 15 | |
| 16 | const resolved = path.isAbsolute(dir) |
| 17 | ? dir |
| 18 | : path.resolve(process.cwd(), dir); |
| 19 | |
| 20 | if (checkExisting && !fs.existsSync(resolved)) { |
| 21 | return process.cwd(); |
| 22 | } else { |
| 23 | return resolved; |
| 24 | } |
| 25 | } |
no outgoing calls
no test coverage detected