| 27 | return undefined; |
| 28 | } |
| 29 | export function getFilePath(file: Uri | undefined) { |
| 30 | const isWindows = getOSType() === OSType.Windows; |
| 31 | if (file) { |
| 32 | const fsPath = uriPath.originalFSPath(file); |
| 33 | |
| 34 | // Remove separator on the front if not a network drive. |
| 35 | // Example, if you create a URI with Uri.file('hello world'), the fsPath will come out as '\Hello World' on windows. We don't want that |
| 36 | // However if you create a URI from a network drive, like '\\mydrive\foo\bar\python.exe', we want to keep the \\ on the front. |
| 37 | if (fsPath && fsPath.startsWith(path.sep) && fsPath.length > 1 && fsPath[1] !== path.sep && isWindows) { |
| 38 | return fsPath.slice(1); |
| 39 | } |
| 40 | return fsPath || ''; |
| 41 | } |
| 42 | return ''; |
| 43 | } |
| 44 | |
| 45 | export function getDisplayPath( |
| 46 | filename: Uri | string | undefined, |