(filePath: string)
| 43 | * @returns The resolved real path, or the expanded path if resolution fails |
| 44 | */ |
| 45 | export function resolveSymlink(filePath: string): string { |
| 46 | const expandedPath = expandTilde(filePath); |
| 47 | try { |
| 48 | return realpathSync(expandedPath); |
| 49 | } catch { |
| 50 | // If realpathSync fails (e.g., file doesn't exist), |
| 51 | // fall back to the expanded path |
| 52 | return expandedPath; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Check if a path points to an existing file. |
no test coverage detected