forked from microsoft/vscode-python-environments
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpathUtils.ts
More file actions
28 lines (26 loc) · 782 Bytes
/
pathUtils.ts
File metadata and controls
28 lines (26 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Uri } from 'vscode';
import { isWindows } from '../../managers/common/utils';
export function checkUri(scope?: Uri | Uri[] | string): Uri | Uri[] | string | undefined {
if (scope instanceof Uri) {
if (scope.scheme === 'vscode-notebook-cell') {
return Uri.from({
scheme: 'vscode-notebook',
path: scope.path,
authority: scope.authority,
});
}
}
if (Array.isArray(scope)) {
return scope.map((item) => {
return checkUri(item) as Uri;
});
}
return scope;
}
export function normalizePath(path: string): string {
const path1 = path.replace(/\\/g, '/');
if (isWindows()) {
return path1.toLowerCase();
}
return path1;
}