(expectedPath: Uri)
| 6 | import { getOSType, OSType } from './utils/platform'; |
| 7 | |
| 8 | export async function tryGetRealPath(expectedPath: Uri): Promise<Uri> { |
| 9 | try { |
| 10 | // Real path throws if the expected path is not actually created yet. |
| 11 | let realPath = await fsExtra.realpath(expectedPath.fsPath); |
| 12 | |
| 13 | // Make sure on linux we use the correct separator |
| 14 | if (getOSType() != OSType.Windows) { |
| 15 | realPath = realPath.replace(/\\/g, '/'); |
| 16 | } |
| 17 | |
| 18 | return Uri.file(realPath); |
| 19 | } catch { |
| 20 | // So if that happens, just return the original path. |
| 21 | return expectedPath; |
| 22 | } |
| 23 | } |
no test coverage detected