( path: string, ide: IDE, dirUriCandidates?: string[], )
| 12 | Only returns fully resolved URI if it exists |
| 13 | */ |
| 14 | export async function resolveRelativePathInDir( |
| 15 | path: string, |
| 16 | ide: IDE, |
| 17 | dirUriCandidates?: string[], |
| 18 | ): Promise<string | undefined> { |
| 19 | const dirs = dirUriCandidates ?? (await ide.getWorkspaceDirs()); |
| 20 | for (const dirUri of dirs) { |
| 21 | const fullUri = joinPathsToUri(dirUri, path); |
| 22 | if (await ide.fileExists(fullUri)) { |
| 23 | return fullUri; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | return undefined; |
| 28 | } |
| 29 | |
| 30 | /* |
| 31 | Same as above but in this case the relative path does not need to exist (e.g. file to be created, etc) |
no test coverage detected