| 81 | } |
| 82 | |
| 83 | export function getRelativePath(file:string, workspace:string):string|undefined { |
| 84 | let directory = workspaces[workspace]; |
| 85 | if(!directory) { |
| 86 | console.error(`Unable to get relative path for '${file}' in unregistered workspace '${workspace}'`); |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | if(file.indexOf("./") === 0) { |
| 91 | file = file.slice(2); |
| 92 | } |
| 93 | |
| 94 | if(file.indexOf(directory) === 0) { |
| 95 | file = file.slice(directory.length); |
| 96 | } |
| 97 | return "/" + workspace + "/" + file; |
| 98 | } |
| 99 | |
| 100 | export function getAbsolutePath(file:string, workspace:string) { |
| 101 | let directory = workspaces[workspace]; |