(p: string, cwd: string)
| 307 | } |
| 308 | |
| 309 | function normalizeRel(p: string, cwd: string): string { |
| 310 | let rel = p.trim().replace(/^['"]|['"]$/g, ''); |
| 311 | if (path.isAbsolute(rel)) rel = path.relative(cwd, rel); |
| 312 | return rel.replace(/^\.\//, ''); |
| 313 | } |
| 314 | |
| 315 | async function isNewFile(cwd: string, rel: string): Promise<boolean> { |
| 316 | try { await fs.stat(path.join(cwd, rel)); return false; } catch { return true; } |