mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
paths - move path to extpath
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as extpath from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as paths from 'vs/base/common/paths.node';
|
||||
import { LRUCache } from 'vs/base/common/map';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { normalize } from 'vs/base/common/extpath';
|
||||
import { sep, posix } from 'vs/base/common/paths.node';
|
||||
import { endsWith, ltrim, startsWithIgnoreCase, rtrim, startsWith } from 'vs/base/common/strings';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as extpath from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as paths from 'vs/base/common/paths.node';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { equalsIgnoreCase } from 'vs/base/common/strings';
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as nls from 'vs/nls';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
import { IStringDictionary } from 'vs/base/common/collections';
|
||||
import * as Objects from 'vs/base/common/objects';
|
||||
import * as TPath from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as Platform from 'vs/base/common/platform';
|
||||
import { LineDecoder } from 'vs/base/node/decoder';
|
||||
import { CommandOptions, ForkOptions, SuccessData, Source, TerminateResponse, TerminateResponseCode, Executable } from 'vs/base/common/processes';
|
||||
@@ -168,7 +168,7 @@ export abstract class AbstractProcess<TProgressData> {
|
||||
}
|
||||
|
||||
public start(pp: ProgressCallback<TProgressData>): Promise<SuccessData> {
|
||||
if (Platform.isWindows && ((this.options && this.options.cwd && TPath.isUNC(this.options.cwd)) || !this.options && TPath.isUNC(process.cwd()))) {
|
||||
if (Platform.isWindows && ((this.options && this.options.cwd && extpath.isUNC(this.options.cwd)) || !this.options && extpath.isUNC(process.cwd()))) {
|
||||
return Promise.reject(new Error(nls.localize('TaskRunner.UNC', 'Can\'t execute a shell command on a UNC drive.')));
|
||||
}
|
||||
return this.useExec().then((useExec) => {
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
|
||||
suite('Paths', () => {
|
||||
|
||||
test('normalize', () => {
|
||||
assert.equal(extpath.normalize(''), '.');
|
||||
assert.equal(extpath.normalize('.'), '.');
|
||||
assert.equal(extpath.normalize('.'), '.');
|
||||
assert.equal(extpath.normalize('../../far'), '../../far');
|
||||
assert.equal(extpath.normalize('../bar'), '../bar');
|
||||
assert.equal(extpath.normalize('../far'), '../far');
|
||||
assert.equal(extpath.normalize('./'), './');
|
||||
assert.equal(extpath.normalize('./././'), './');
|
||||
assert.equal(extpath.normalize('./ff/./'), 'ff/');
|
||||
assert.equal(extpath.normalize('./foo'), 'foo');
|
||||
assert.equal(extpath.normalize('/'), '/');
|
||||
assert.equal(extpath.normalize('/..'), '/');
|
||||
assert.equal(extpath.normalize('///'), '/');
|
||||
assert.equal(extpath.normalize('//foo'), '/foo');
|
||||
assert.equal(extpath.normalize('//foo//'), '/foo/');
|
||||
assert.equal(extpath.normalize('/foo'), '/foo');
|
||||
assert.equal(extpath.normalize('/foo/bar.test'), '/foo/bar.test');
|
||||
assert.equal(extpath.normalize('\\\\\\'), '/');
|
||||
assert.equal(extpath.normalize('c:/../ff'), 'c:/ff');
|
||||
assert.equal(extpath.normalize('c:\\./'), 'c:/');
|
||||
assert.equal(extpath.normalize('foo/'), 'foo/');
|
||||
assert.equal(extpath.normalize('foo/../../bar'), '../bar');
|
||||
assert.equal(extpath.normalize('foo/./'), 'foo/');
|
||||
assert.equal(extpath.normalize('foo/./bar'), 'foo/bar');
|
||||
assert.equal(extpath.normalize('foo//'), 'foo/');
|
||||
assert.equal(extpath.normalize('foo//'), 'foo/');
|
||||
assert.equal(extpath.normalize('foo//bar'), 'foo/bar');
|
||||
assert.equal(extpath.normalize('foo//bar/far'), 'foo/bar/far');
|
||||
assert.equal(extpath.normalize('foo/bar/../../far'), 'far');
|
||||
assert.equal(extpath.normalize('foo/bar/../far'), 'foo/far');
|
||||
assert.equal(extpath.normalize('foo/far/../../bar'), 'bar');
|
||||
assert.equal(extpath.normalize('foo/far/../../bar'), 'bar');
|
||||
assert.equal(extpath.normalize('foo/xxx/..'), 'foo');
|
||||
assert.equal(extpath.normalize('foo/xxx/../bar'), 'foo/bar');
|
||||
assert.equal(extpath.normalize('foo/xxx/./..'), 'foo');
|
||||
assert.equal(extpath.normalize('foo/xxx/./../bar'), 'foo/bar');
|
||||
assert.equal(extpath.normalize('foo/xxx/./bar'), 'foo/xxx/bar');
|
||||
assert.equal(extpath.normalize('foo\\bar'), 'foo/bar');
|
||||
assert.equal(extpath.normalize(null), null);
|
||||
assert.equal(extpath.normalize(undefined), undefined);
|
||||
|
||||
// https://github.com/Microsoft/vscode/issues/7234
|
||||
assert.equal(extpath.join('/home/aeschli/workspaces/vscode/extensions/css', './syntaxes/css.plist'), '/home/aeschli/workspaces/vscode/extensions/css/syntaxes/css.plist');
|
||||
});
|
||||
|
||||
test('getRootLength', () => {
|
||||
|
||||
assert.equal(extpath.getRoot('/user/far'), '/');
|
||||
assert.equal(extpath.getRoot('\\\\server\\share\\some\\path'), '//server/share/');
|
||||
assert.equal(extpath.getRoot('//server/share/some/path'), '//server/share/');
|
||||
assert.equal(extpath.getRoot('//server/share'), '/');
|
||||
assert.equal(extpath.getRoot('//server'), '/');
|
||||
assert.equal(extpath.getRoot('//server//'), '/');
|
||||
assert.equal(extpath.getRoot('c:/user/far'), 'c:/');
|
||||
assert.equal(extpath.getRoot('c:user/far'), 'c:');
|
||||
assert.equal(extpath.getRoot('http://www'), '');
|
||||
assert.equal(extpath.getRoot('http://www/'), 'http://www/');
|
||||
assert.equal(extpath.getRoot('file:///foo'), 'file:///');
|
||||
assert.equal(extpath.getRoot('file://foo'), '');
|
||||
|
||||
});
|
||||
|
||||
test('join', () => {
|
||||
assert.equal(extpath.join('.', 'bar'), 'bar');
|
||||
assert.equal(extpath.join('../../foo/bar', '../../foo'), '../../foo');
|
||||
assert.equal(extpath.join('../../foo/bar', '../bar/foo'), '../../foo/bar/foo');
|
||||
assert.equal(extpath.join('../foo/bar', '../bar/foo'), '../foo/bar/foo');
|
||||
assert.equal(extpath.join('/', 'bar'), '/bar');
|
||||
assert.equal(extpath.join('//server/far/boo', '../file.txt'), '//server/far/file.txt');
|
||||
assert.equal(extpath.join('/foo/', '/bar'), '/foo/bar');
|
||||
assert.equal(extpath.join('\\\\server\\far\\boo', '../file.txt'), '//server/far/file.txt');
|
||||
assert.equal(extpath.join('\\\\server\\far\\boo', './file.txt'), '//server/far/boo/file.txt');
|
||||
assert.equal(extpath.join('\\\\server\\far\\boo', '.\\file.txt'), '//server/far/boo/file.txt');
|
||||
assert.equal(extpath.join('\\\\server\\far\\boo', 'file.txt'), '//server/far/boo/file.txt');
|
||||
assert.equal(extpath.join('file:///c/users/test', 'test'), 'file:///c/users/test/test');
|
||||
assert.equal(extpath.join('file://localhost/c$/GitDevelopment/express', './settings'), 'file://localhost/c$/GitDevelopment/express/settings'); // unc
|
||||
assert.equal(extpath.join('file://localhost/c$/GitDevelopment/express', '.settings'), 'file://localhost/c$/GitDevelopment/express/.settings'); // unc
|
||||
assert.equal(extpath.join('foo', '/bar'), 'foo/bar');
|
||||
assert.equal(extpath.join('foo', 'bar'), 'foo/bar');
|
||||
assert.equal(extpath.join('foo', 'bar/'), 'foo/bar/');
|
||||
assert.equal(extpath.join('foo/', '/bar'), 'foo/bar');
|
||||
assert.equal(extpath.join('foo/', '/bar/'), 'foo/bar/');
|
||||
assert.equal(extpath.join('foo/', 'bar'), 'foo/bar');
|
||||
assert.equal(extpath.join('foo/bar', '../bar/foo'), 'foo/bar/foo');
|
||||
assert.equal(extpath.join('foo/bar', './bar/foo'), 'foo/bar/bar/foo');
|
||||
assert.equal(extpath.join('http://localhost/test', '../next'), 'http://localhost/next');
|
||||
assert.equal(extpath.join('http://localhost/test', 'test'), 'http://localhost/test/test');
|
||||
});
|
||||
|
||||
test('isUNC', () => {
|
||||
if (platform.isWindows) {
|
||||
assert.ok(!extpath.isUNC('foo'));
|
||||
assert.ok(!extpath.isUNC('/foo'));
|
||||
assert.ok(!extpath.isUNC('\\foo'));
|
||||
assert.ok(!extpath.isUNC('\\\\foo'));
|
||||
assert.ok(extpath.isUNC('\\\\a\\b'));
|
||||
assert.ok(!extpath.isUNC('//a/b'));
|
||||
assert.ok(extpath.isUNC('\\\\server\\share'));
|
||||
assert.ok(extpath.isUNC('\\\\server\\share\\'));
|
||||
assert.ok(extpath.isUNC('\\\\server\\share\\path'));
|
||||
}
|
||||
});
|
||||
|
||||
test('isValidBasename', () => {
|
||||
assert.ok(!extpath.isValidBasename(null));
|
||||
assert.ok(!extpath.isValidBasename(''));
|
||||
assert.ok(extpath.isValidBasename('test.txt'));
|
||||
assert.ok(!extpath.isValidBasename('/test.txt'));
|
||||
assert.ok(!extpath.isValidBasename('\\test.txt'));
|
||||
|
||||
if (platform.isWindows) {
|
||||
assert.ok(!extpath.isValidBasename('aux'));
|
||||
assert.ok(!extpath.isValidBasename('Aux'));
|
||||
assert.ok(!extpath.isValidBasename('LPT0'));
|
||||
assert.ok(!extpath.isValidBasename('test.txt.'));
|
||||
assert.ok(!extpath.isValidBasename('test.txt..'));
|
||||
assert.ok(!extpath.isValidBasename('test.txt '));
|
||||
assert.ok(!extpath.isValidBasename('test.txt\t'));
|
||||
assert.ok(!extpath.isValidBasename('tes:t.txt'));
|
||||
assert.ok(!extpath.isValidBasename('tes"t.txt'));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,134 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
|
||||
suite('Paths', () => {
|
||||
|
||||
test('normalize', () => {
|
||||
assert.equal(paths.normalize(''), '.');
|
||||
assert.equal(paths.normalize('.'), '.');
|
||||
assert.equal(paths.normalize('.'), '.');
|
||||
assert.equal(paths.normalize('../../far'), '../../far');
|
||||
assert.equal(paths.normalize('../bar'), '../bar');
|
||||
assert.equal(paths.normalize('../far'), '../far');
|
||||
assert.equal(paths.normalize('./'), './');
|
||||
assert.equal(paths.normalize('./././'), './');
|
||||
assert.equal(paths.normalize('./ff/./'), 'ff/');
|
||||
assert.equal(paths.normalize('./foo'), 'foo');
|
||||
assert.equal(paths.normalize('/'), '/');
|
||||
assert.equal(paths.normalize('/..'), '/');
|
||||
assert.equal(paths.normalize('///'), '/');
|
||||
assert.equal(paths.normalize('//foo'), '/foo');
|
||||
assert.equal(paths.normalize('//foo//'), '/foo/');
|
||||
assert.equal(paths.normalize('/foo'), '/foo');
|
||||
assert.equal(paths.normalize('/foo/bar.test'), '/foo/bar.test');
|
||||
assert.equal(paths.normalize('\\\\\\'), '/');
|
||||
assert.equal(paths.normalize('c:/../ff'), 'c:/ff');
|
||||
assert.equal(paths.normalize('c:\\./'), 'c:/');
|
||||
assert.equal(paths.normalize('foo/'), 'foo/');
|
||||
assert.equal(paths.normalize('foo/../../bar'), '../bar');
|
||||
assert.equal(paths.normalize('foo/./'), 'foo/');
|
||||
assert.equal(paths.normalize('foo/./bar'), 'foo/bar');
|
||||
assert.equal(paths.normalize('foo//'), 'foo/');
|
||||
assert.equal(paths.normalize('foo//'), 'foo/');
|
||||
assert.equal(paths.normalize('foo//bar'), 'foo/bar');
|
||||
assert.equal(paths.normalize('foo//bar/far'), 'foo/bar/far');
|
||||
assert.equal(paths.normalize('foo/bar/../../far'), 'far');
|
||||
assert.equal(paths.normalize('foo/bar/../far'), 'foo/far');
|
||||
assert.equal(paths.normalize('foo/far/../../bar'), 'bar');
|
||||
assert.equal(paths.normalize('foo/far/../../bar'), 'bar');
|
||||
assert.equal(paths.normalize('foo/xxx/..'), 'foo');
|
||||
assert.equal(paths.normalize('foo/xxx/../bar'), 'foo/bar');
|
||||
assert.equal(paths.normalize('foo/xxx/./..'), 'foo');
|
||||
assert.equal(paths.normalize('foo/xxx/./../bar'), 'foo/bar');
|
||||
assert.equal(paths.normalize('foo/xxx/./bar'), 'foo/xxx/bar');
|
||||
assert.equal(paths.normalize('foo\\bar'), 'foo/bar');
|
||||
assert.equal(paths.normalize(null), null);
|
||||
assert.equal(paths.normalize(undefined), undefined);
|
||||
|
||||
// https://github.com/Microsoft/vscode/issues/7234
|
||||
assert.equal(paths.join('/home/aeschli/workspaces/vscode/extensions/css', './syntaxes/css.plist'), '/home/aeschli/workspaces/vscode/extensions/css/syntaxes/css.plist');
|
||||
});
|
||||
|
||||
test('getRootLength', () => {
|
||||
|
||||
assert.equal(paths.getRoot('/user/far'), '/');
|
||||
assert.equal(paths.getRoot('\\\\server\\share\\some\\path'), '//server/share/');
|
||||
assert.equal(paths.getRoot('//server/share/some/path'), '//server/share/');
|
||||
assert.equal(paths.getRoot('//server/share'), '/');
|
||||
assert.equal(paths.getRoot('//server'), '/');
|
||||
assert.equal(paths.getRoot('//server//'), '/');
|
||||
assert.equal(paths.getRoot('c:/user/far'), 'c:/');
|
||||
assert.equal(paths.getRoot('c:user/far'), 'c:');
|
||||
assert.equal(paths.getRoot('http://www'), '');
|
||||
assert.equal(paths.getRoot('http://www/'), 'http://www/');
|
||||
assert.equal(paths.getRoot('file:///foo'), 'file:///');
|
||||
assert.equal(paths.getRoot('file://foo'), '');
|
||||
|
||||
});
|
||||
|
||||
test('join', () => {
|
||||
assert.equal(paths.join('.', 'bar'), 'bar');
|
||||
assert.equal(paths.join('../../foo/bar', '../../foo'), '../../foo');
|
||||
assert.equal(paths.join('../../foo/bar', '../bar/foo'), '../../foo/bar/foo');
|
||||
assert.equal(paths.join('../foo/bar', '../bar/foo'), '../foo/bar/foo');
|
||||
assert.equal(paths.join('/', 'bar'), '/bar');
|
||||
assert.equal(paths.join('//server/far/boo', '../file.txt'), '//server/far/file.txt');
|
||||
assert.equal(paths.join('/foo/', '/bar'), '/foo/bar');
|
||||
assert.equal(paths.join('\\\\server\\far\\boo', '../file.txt'), '//server/far/file.txt');
|
||||
assert.equal(paths.join('\\\\server\\far\\boo', './file.txt'), '//server/far/boo/file.txt');
|
||||
assert.equal(paths.join('\\\\server\\far\\boo', '.\\file.txt'), '//server/far/boo/file.txt');
|
||||
assert.equal(paths.join('\\\\server\\far\\boo', 'file.txt'), '//server/far/boo/file.txt');
|
||||
assert.equal(paths.join('file:///c/users/test', 'test'), 'file:///c/users/test/test');
|
||||
assert.equal(paths.join('file://localhost/c$/GitDevelopment/express', './settings'), 'file://localhost/c$/GitDevelopment/express/settings'); // unc
|
||||
assert.equal(paths.join('file://localhost/c$/GitDevelopment/express', '.settings'), 'file://localhost/c$/GitDevelopment/express/.settings'); // unc
|
||||
assert.equal(paths.join('foo', '/bar'), 'foo/bar');
|
||||
assert.equal(paths.join('foo', 'bar'), 'foo/bar');
|
||||
assert.equal(paths.join('foo', 'bar/'), 'foo/bar/');
|
||||
assert.equal(paths.join('foo/', '/bar'), 'foo/bar');
|
||||
assert.equal(paths.join('foo/', '/bar/'), 'foo/bar/');
|
||||
assert.equal(paths.join('foo/', 'bar'), 'foo/bar');
|
||||
assert.equal(paths.join('foo/bar', '../bar/foo'), 'foo/bar/foo');
|
||||
assert.equal(paths.join('foo/bar', './bar/foo'), 'foo/bar/bar/foo');
|
||||
assert.equal(paths.join('http://localhost/test', '../next'), 'http://localhost/next');
|
||||
assert.equal(paths.join('http://localhost/test', 'test'), 'http://localhost/test/test');
|
||||
});
|
||||
|
||||
test('isUNC', () => {
|
||||
if (platform.isWindows) {
|
||||
assert.ok(!paths.isUNC('foo'));
|
||||
assert.ok(!paths.isUNC('/foo'));
|
||||
assert.ok(!paths.isUNC('\\foo'));
|
||||
assert.ok(!paths.isUNC('\\\\foo'));
|
||||
assert.ok(paths.isUNC('\\\\a\\b'));
|
||||
assert.ok(!paths.isUNC('//a/b'));
|
||||
assert.ok(paths.isUNC('\\\\server\\share'));
|
||||
assert.ok(paths.isUNC('\\\\server\\share\\'));
|
||||
assert.ok(paths.isUNC('\\\\server\\share\\path'));
|
||||
}
|
||||
});
|
||||
|
||||
test('isValidBasename', () => {
|
||||
assert.ok(!paths.isValidBasename(null));
|
||||
assert.ok(!paths.isValidBasename(''));
|
||||
assert.ok(paths.isValidBasename('test.txt'));
|
||||
assert.ok(!paths.isValidBasename('/test.txt'));
|
||||
assert.ok(!paths.isValidBasename('\\test.txt'));
|
||||
|
||||
if (platform.isWindows) {
|
||||
assert.ok(!paths.isValidBasename('aux'));
|
||||
assert.ok(!paths.isValidBasename('Aux'));
|
||||
assert.ok(!paths.isValidBasename('LPT0'));
|
||||
assert.ok(!paths.isValidBasename('test.txt.'));
|
||||
assert.ok(!paths.isValidBasename('test.txt..'));
|
||||
assert.ok(!paths.isValidBasename('test.txt '));
|
||||
assert.ok(!paths.isValidBasename('test.txt\t'));
|
||||
assert.ok(!paths.isValidBasename('tes:t.txt'));
|
||||
assert.ok(!paths.isValidBasename('tes"t.txt'));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { normalize } from 'vs/base/common/extpath';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { canceled } from 'vs/base/common/errors';
|
||||
|
||||
@@ -49,7 +49,7 @@ export class DeferredPromise<T> {
|
||||
}
|
||||
|
||||
export function toResource(this: any, path: string) {
|
||||
return URI.file(paths.join('C:\\', Buffer.from(this.test.fullTitle()).toString('base64'), path));
|
||||
return URI.file(extpath.join('C:\\', Buffer.from(this.test.fullTitle()).toString('base64'), path));
|
||||
}
|
||||
|
||||
export function suiteRepeat(n: number, description: string, callback: (this: any) => void): void {
|
||||
|
||||
@@ -63,7 +63,7 @@ import { hasArgs } from 'vs/platform/environment/node/argv';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { registerContextMenuListener } from 'vs/base/parts/contextmenu/electron-main/contextmenu';
|
||||
import { storeBackgroundColor } from 'vs/code/electron-main/theme';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { homedir } from 'os';
|
||||
import { sep } from 'vs/base/common/paths.node';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as path from 'vs/base/common/paths.node';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
@@ -48,7 +48,7 @@ function doValidatePaths(args: string[], gotoLineMode?: boolean): string[] {
|
||||
const sanitizedFilePath = sanitizeFilePath(pathCandidate, cwd);
|
||||
|
||||
const basename = path.basename(sanitizedFilePath);
|
||||
if (basename /* can be empty if code is opened on root */ && !paths.isValidBasename(basename)) {
|
||||
if (basename /* can be empty if code is opened on root */ && !extpath.isValidBasename(basename)) {
|
||||
return null; // do not allow invalid file names
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { OpenContext } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceIdentifier, IResolvedWorkspace, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -98,7 +98,7 @@ export function findWindowOnWorkspace<W extends ISimpleWindow>(windows: W[], wor
|
||||
export function findWindowOnExtensionDevelopmentPath<W extends ISimpleWindow>(windows: W[], extensionDevelopmentPath: string): W | null {
|
||||
for (const window of windows) {
|
||||
// match on extension development path. The path can be a path or uri string, using paths.isEqual is not 100% correct but good enough
|
||||
if (window.extensionDevelopmentPath && paths.isEqual(window.extensionDevelopmentPath, extensionDevelopmentPath, !platform.isLinux /* ignorecase */)) {
|
||||
if (window.extensionDevelopmentPath && extpath.isEqual(window.extensionDevelopmentPath, extensionDevelopmentPath, !platform.isLinux /* ignorecase */)) {
|
||||
return window;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { isEqual as areResourcesEquals, getComparisonKey, hasToIgnoreCase } from 'vs/base/common/resources';
|
||||
import { isEqual } from 'vs/base/common/paths';
|
||||
import { isEqual } from 'vs/base/common/extpath';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { writeFile, readFile, readdir, exists, del, rename } from 'vs/base/node/pfs';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { join, isEqual, isEqualOrParent } from 'vs/base/common/paths';
|
||||
import { join, isEqual, isEqualOrParent } from 'vs/base/common/extpath';
|
||||
import { FileChangeType, FileChangesEvent, isParent } from 'vs/platform/files/common/files';
|
||||
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { Event as CommonEvent, Emitter } from 'vs/base/common/event';
|
||||
import { isWindows, isMacintosh, isLinux } from 'vs/base/common/platform';
|
||||
import { IWorkspaceIdentifier, IWorkspacesMainService, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IHistoryMainService, IRecentlyOpened } from 'vs/platform/history/common/history';
|
||||
import { isEqual } from 'vs/base/common/paths';
|
||||
import { isEqual } from 'vs/base/common/extpath';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { getComparisonKey, isEqual as areResourcesEqual, dirname, fsPath } from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IWorkspaceFolder, IWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { isEqualOrParent, normalize } from 'vs/base/common/paths';
|
||||
import { isEqualOrParent, normalize } from 'vs/base/common/extpath';
|
||||
import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
|
||||
import { isAbsolute, relative, posix, resolve, extname } from 'vs/base/common/paths.node';
|
||||
import { normalizeDriveLetter } from 'vs/base/common/labels';
|
||||
|
||||
@@ -12,7 +12,7 @@ import { isLinux } from 'vs/base/common/platform';
|
||||
import { delSync, readdirSync, writeFileAndFlushSync } from 'vs/base/node/extfs';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { isEqual } from 'vs/base/common/paths';
|
||||
import { isEqual } from 'vs/base/common/extpath';
|
||||
import { createHash } from 'crypto';
|
||||
import * as json from 'vs/base/common/json';
|
||||
import { toWorkspaceFolders } from 'vs/platform/workspace/common/workspace';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { TernarySearchTree } from 'vs/base/common/map';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -857,7 +857,7 @@ class Extension<T> implements vscode.Extension<T> {
|
||||
this._extensionService = extensionService;
|
||||
this._identifier = description.identifier;
|
||||
this.id = description.identifier.value;
|
||||
this.extensionPath = paths.normalize(originalFSPath(description.extensionLocation), true);
|
||||
this.extensionPath = extpath.normalize(originalFSPath(description.extensionLocation), true);
|
||||
this.packageJSON = description;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
@@ -881,7 +881,7 @@ export class ExtHostVariableResolverService extends AbstractVariableResolverServ
|
||||
if (activeEditor) {
|
||||
const resource = activeEditor.document.uri;
|
||||
if (resource.scheme === Schemas.file) {
|
||||
return paths.normalize(resource.fsPath, true);
|
||||
return extpath.normalize(resource.fsPath, true);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { ILogService, DelegatedLogService, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
|
||||
import { ExtHostLogServiceShape } from 'vs/workbench/api/node/extHost.protocol';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { TernarySearchTree } from 'vs/base/common/map';
|
||||
import { Counter } from 'vs/base/common/numbers';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { normalize } from 'vs/base/common/extpath';
|
||||
import { isLinux } from 'vs/base/common/platform';
|
||||
import { basenameOrAuthority, dirname, isEqual } from 'vs/base/common/resources';
|
||||
import { compare } from 'vs/base/common/strings';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { hasWorkspaceFileExtension, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { normalize } from 'vs/base/common/extpath';
|
||||
import { basename, basenameOrAuthority } from 'vs/base/common/resources';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IWindowsService, IWindowService, IURIToOpen } from 'vs/platform/windows/common/windows';
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { createMatches, FuzzyScore } from 'vs/base/common/filters';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { basename, dirname, isEqual } from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import 'vs/css!./media/breadcrumbscontrol';
|
||||
|
||||
@@ -33,7 +33,7 @@ import { EventType as TouchEventType, GestureEvent } from 'vs/base/browser/touch
|
||||
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
|
||||
import { IEditorGroupsAccessor, IEditorGroupView, IEditorPartOptionsChangeEvent, getActiveTextEditorOptions, IEditorOpeningEvent } from 'vs/workbench/browser/parts/editor/editor';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ActionRunner, IAction, Action } from 'vs/base/common/actions';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { relative } from 'vs/base/common/paths.node';
|
||||
@@ -197,7 +197,7 @@ export class ResourceGlobMatcher extends Disposable {
|
||||
// but can match on "src/file.txt"
|
||||
let resourcePathToMatch: string;
|
||||
if (folder) {
|
||||
resourcePathToMatch = paths.normalize(relative(folder.uri.fsPath, resource.fsPath));
|
||||
resourcePathToMatch = extpath.normalize(relative(folder.uri.fsPath, resource.fsPath));
|
||||
} else {
|
||||
resourcePathToMatch = resource.fsPath;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import * as stream from 'stream';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as net from 'net';
|
||||
import * as path from 'vs/base/common/paths.node';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
@@ -441,7 +441,7 @@ export class ExecutableDebugAdapter extends StreamDebugAdapter {
|
||||
const result: IDebuggerContribution = Object.create(null);
|
||||
if (contribution.runtime) {
|
||||
if (contribution.runtime.indexOf('./') === 0) { // TODO
|
||||
result.runtime = paths.join(extensionFolderPath, contribution.runtime);
|
||||
result.runtime = extpath.join(extensionFolderPath, contribution.runtime);
|
||||
} else {
|
||||
result.runtime = contribution.runtime;
|
||||
}
|
||||
@@ -451,7 +451,7 @@ export class ExecutableDebugAdapter extends StreamDebugAdapter {
|
||||
}
|
||||
if (contribution.program) {
|
||||
if (!path.isAbsolute(contribution.program)) {
|
||||
result.program = paths.join(extensionFolderPath, contribution.program);
|
||||
result.program = extpath.join(extensionFolderPath, contribution.program);
|
||||
} else {
|
||||
result.program = contribution.program;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as assert from 'assert';
|
||||
import { URI as uri } from 'vs/base/common/uri';
|
||||
import { Source } from 'vs/workbench/contrib/debug/common/debugSource';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { normalize } from 'vs/base/common/extpath';
|
||||
|
||||
suite('Debug - Source', () => {
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { IDebugAdapterExecutable, IConfigurationManager, IConfig, IDebugSession } from 'vs/workbench/contrib/debug/common/debug';
|
||||
import { Debugger } from 'vs/workbench/contrib/debug/node/debugger';
|
||||
@@ -144,7 +144,7 @@ suite('Debug - Debugger', () => {
|
||||
|
||||
const ae = ExecutableDebugAdapter.platformAdapterExecutable([extensionDescriptor0], 'mock');
|
||||
|
||||
assert.equal(ae!.command, paths.join(extensionFolderPath, debuggerContribution.program));
|
||||
assert.equal(ae!.command, extpath.join(extensionFolderPath, debuggerContribution.program));
|
||||
assert.deepEqual(ae!.args, debuggerContribution.args);
|
||||
});
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { forEach } from 'vs/base/common/collections';
|
||||
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { match } from 'vs/base/common/glob';
|
||||
@@ -334,7 +334,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
|
||||
* Parse the extensions.json files for given workspace folder and return the recommendations
|
||||
*/
|
||||
private resolveWorkspaceFolderExtensionConfig(workspaceFolder: IWorkspaceFolder): Promise<IExtensionsConfigContent | null> {
|
||||
const extensionsJsonUri = workspaceFolder.toResource(paths.join('.vscode', 'extensions.json'));
|
||||
const extensionsJsonUri = workspaceFolder.toResource(extpath.join('.vscode', 'extensions.json'));
|
||||
|
||||
return Promise.resolve(this.fileService.resolveFile(extensionsJsonUri)
|
||||
.then(() => this.fileService.resolveContent(extensionsJsonUri))
|
||||
@@ -904,8 +904,8 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe
|
||||
.replace('%APPDATA%', process.env['APPDATA']!);
|
||||
promises.push(findExecutable(exeName, windowsPath));
|
||||
} else {
|
||||
promises.push(findExecutable(exeName, paths.join('/usr/local/bin', exeName)));
|
||||
promises.push(findExecutable(exeName, paths.join(homeDir, exeName)));
|
||||
promises.push(findExecutable(exeName, extpath.join('/usr/local/bin', exeName)));
|
||||
promises.push(findExecutable(exeName, extpath.join(homeDir, exeName)));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
|
||||
import { IAction, Action } from 'vs/base/common/actions';
|
||||
import { Throttler, Delayer } from 'vs/base/common/async';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import * as json from 'vs/base/common/json';
|
||||
import { ActionItem, Separator, IActionItemOptions } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
@@ -2042,7 +2042,7 @@ export class ConfigureWorkspaceRecommendedExtensionsAction extends AbstractConfi
|
||||
public run(): Promise<void> {
|
||||
switch (this.contextService.getWorkbenchState()) {
|
||||
case WorkbenchState.FOLDER:
|
||||
return this.openExtensionsFile(this.contextService.getWorkspace().folders[0].toResource(paths.join('.vscode', 'extensions.json')));
|
||||
return this.openExtensionsFile(this.contextService.getWorkspace().folders[0].toResource(extpath.join('.vscode', 'extensions.json')));
|
||||
case WorkbenchState.WORKSPACE:
|
||||
return this.openWorkspaceConfigurationFile(this.contextService.getWorkspace().configuration!);
|
||||
}
|
||||
@@ -2087,7 +2087,7 @@ export class ConfigureWorkspaceFolderRecommendedExtensionsAction extends Abstrac
|
||||
return Promise.resolve(pickFolderPromise)
|
||||
.then(workspaceFolder => {
|
||||
if (workspaceFolder) {
|
||||
return this.openExtensionsFile(workspaceFolder.toResource(paths.join('.vscode', 'extensions.json')));
|
||||
return this.openExtensionsFile(workspaceFolder.toResource(extpath.join('.vscode', 'extensions.json')));
|
||||
}
|
||||
return null;
|
||||
});
|
||||
@@ -2140,7 +2140,7 @@ export class AddToWorkspaceFolderRecommendationsAction extends AbstractConfigure
|
||||
if (!workspaceFolder) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
const configurationFile = workspaceFolder.toResource(paths.join('.vscode', 'extensions.json'));
|
||||
const configurationFile = workspaceFolder.toResource(extpath.join('.vscode', 'extensions.json'));
|
||||
return this.getWorkspaceFolderExtensionsConfigContent(configurationFile).then(content => {
|
||||
const extensionIdLowerCase = extensionId.id.toLowerCase();
|
||||
if (shouldRecommend) {
|
||||
@@ -2525,7 +2525,7 @@ export class OpenExtensionsFolderAction extends Action {
|
||||
if (file.children && file.children.length > 0) {
|
||||
itemToShow = file.children[0].resource.fsPath;
|
||||
} else {
|
||||
itemToShow = paths.normalize(extensionsHome, true);
|
||||
itemToShow = extpath.normalize(extensionsHome, true);
|
||||
}
|
||||
|
||||
return this.windowsService.showItemInFolder(itemToShow);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as nls from 'vs/nls';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { isValidBasename } from 'vs/base/common/paths';
|
||||
import { isValidBasename } from 'vs/base/common/extpath';
|
||||
import { basename } from 'vs/base/common/resources';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { VIEWLET_ID, TEXT_FILE_EDITOR_ID, IExplorerService } from 'vs/workbench/contrib/files/common/files';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { isEqual } from 'vs/base/common/paths';
|
||||
import { isEqual } from 'vs/base/common/extpath';
|
||||
import { posix } from 'vs/base/common/paths.node';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import { ResourceMap } from 'vs/base/common/map';
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'vs/css!./media/fileactions';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { isWindows, isLinux } from 'vs/base/common/platform';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
@@ -245,7 +245,7 @@ class BaseDeleteFileAction extends BaseErrorReportingAction {
|
||||
) {
|
||||
super('moveFileToTrash', MOVE_FILE_TO_TRASH_LABEL, notificationService);
|
||||
|
||||
this.useTrash = useTrash && elements.every(e => !paths.isUNC(e.resource.fsPath)); // on UNC shares there is no trash
|
||||
this.useTrash = useTrash && elements.every(e => !extpath.isUNC(e.resource.fsPath)); // on UNC shares there is no trash
|
||||
this.enabled = this.elements && this.elements.every(e => !e.isReadonly);
|
||||
}
|
||||
|
||||
@@ -916,7 +916,7 @@ export function validateFileName(item: ExplorerItem, name: string): string {
|
||||
}
|
||||
|
||||
// Invalid File name
|
||||
if (names.some((folderName) => !paths.isValidBasename(folderName))) {
|
||||
if (names.some((folderName) => !extpath.isValidBasename(folderName))) {
|
||||
return nls.localize('invalidFileNameError', "The name **{0}** is not valid as a file or folder name. Please choose a different name.", trimLongName(name));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { toResource, IEditorCommandsContext } from 'vs/workbench/common/editor';
|
||||
import { IWindowsService, IWindowService, IURIToOpen } from 'vs/platform/windows/common/windows';
|
||||
@@ -358,9 +358,9 @@ CommandsRegistry.registerCommand({
|
||||
|
||||
function revealResourcesInOS(resources: URI[], windowsService: IWindowsService, notificationService: INotificationService, workspaceContextService: IWorkspaceContextService): void {
|
||||
if (resources.length) {
|
||||
sequence(resources.map(r => () => windowsService.showItemInFolder(paths.normalize(r.fsPath, true))));
|
||||
sequence(resources.map(r => () => windowsService.showItemInFolder(extpath.normalize(r.fsPath, true))));
|
||||
} else if (workspaceContextService.getWorkspace().folders.length) {
|
||||
windowsService.showItemInFolder(paths.normalize(workspaceContextService.getWorkspace().folders[0].uri.fsPath, true));
|
||||
windowsService.showItemInFolder(extpath.normalize(workspaceContextService.getWorkspace().folders[0].uri.fsPath, true));
|
||||
} else {
|
||||
notificationService.info(nls.localize('openFileToReveal', "Open a file first to reveal"));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import { localize } from 'vs/nls';
|
||||
import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { once } from 'vs/base/common/functional';
|
||||
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { normalize } from 'vs/base/common/extpath';
|
||||
import { equals, deepClone } from 'vs/base/common/objects';
|
||||
import * as path from 'vs/base/common/paths.node';
|
||||
import { ExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { workbenchInstantiationService, TestTextFileService } from 'vs/workbench/test/workbenchTestServices';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as assert from 'assert';
|
||||
import { FileEditorTracker } from 'vs/workbench/contrib/files/browser/editors/fileEditorTracker';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { workbenchInstantiationService, TestTextFileService, TestFileService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as assert from 'assert';
|
||||
import { isLinux, isWindows } from 'vs/base/common/platform';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { validateFileName } from 'vs/workbench/contrib/files/electron-browser/fileActions';
|
||||
import { ExplorerItem } from 'vs/workbench/contrib/files/common/explorerModel';
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import Severity from 'vs/base/common/severity';
|
||||
import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Action } from 'vs/base/common/actions';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IEditor } from 'vs/workbench/common/editor';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { language } from 'vs/base/common/platform';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IOutputChannelRegistry, Extensions as OutputExt, } from 'vs/workbench/contrib/output/common/output';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
import { ILogService, LogLevel, DEFAULT_LOG_LEVEL } from 'vs/platform/log/common/log';
|
||||
@@ -24,7 +24,7 @@ export class OpenLogsFolderAction extends Action {
|
||||
}
|
||||
|
||||
run(): Promise<void> {
|
||||
return this.windowsService.showItemInFolder(paths.join(this.environmentService.logsPath, 'main.log'));
|
||||
return this.windowsService.showItemInFolder(extpath.join(this.environmentService.logsPath, 'main.log'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import { FilterOptions } from 'vs/workbench/contrib/markers/electron-browser/mar
|
||||
import { IExpression, getEmptyExpression } from 'vs/base/common/glob';
|
||||
import { mixin, deepClone } from 'vs/base/common/objects';
|
||||
import { IWorkspaceFolder, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { isAbsolute } from 'vs/base/common/paths.node';
|
||||
import { FilterData, Filter, VirtualDelegate, ResourceMarkersRenderer, MarkerRenderer, RelatedInformationRenderer, TreeElement, MarkersTreeAccessibilityProvider, MarkersViewModel, ResourceDragAndDrop } from 'vs/workbench/contrib/markers/electron-browser/markersTreeViewer';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { IMirrorModel, IWorkerContext } from 'vs/editor/common/services/editorSimpleWorker';
|
||||
import { ILink } from 'vs/editor/common/modes';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
@@ -88,8 +88,8 @@ export class OutputLinkComputer {
|
||||
|
||||
const workspaceFolderPath = workspaceFolder.scheme === 'file' ? workspaceFolder.fsPath : workspaceFolder.path;
|
||||
const workspaceFolderVariants = arrays.distinct([
|
||||
paths.normalize(workspaceFolderPath, true),
|
||||
paths.normalize(workspaceFolderPath, false)
|
||||
extpath.normalize(workspaceFolderPath, true),
|
||||
extpath.normalize(workspaceFolderPath, false)
|
||||
]);
|
||||
|
||||
workspaceFolderVariants.forEach(workspaceFolderVariant => {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { dirname } from 'vs/base/common/paths.node';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as extfs from 'vs/base/node/extfs';
|
||||
@@ -185,7 +185,7 @@ class OutputChannelBackedByFile extends AbstractFileOutputChannel implements Out
|
||||
@IModeService modeService: IModeService,
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
super({ ...outputChannelDescriptor, file: URI.file(paths.join(outputDir, `${outputChannelDescriptor.id}.log`)) }, modelUri, fileService, modelService, modeService);
|
||||
super({ ...outputChannelDescriptor, file: URI.file(extpath.join(outputDir, `${outputChannelDescriptor.id}.log`)) }, modelUri, fileService, modelService, modeService);
|
||||
|
||||
// Use one rotating file to check for main file reset
|
||||
this.appender = new OutputAppender(this.id, this.file.fsPath);
|
||||
@@ -447,7 +447,7 @@ export class OutputService extends Disposable implements IOutputService, ITextMo
|
||||
) {
|
||||
super();
|
||||
this.activeChannelIdInStorage = this.storageService.get(OUTPUT_ACTIVE_CHANNEL_KEY, StorageScope.WORKSPACE, null);
|
||||
this.outputDir = paths.join(environmentService.logsPath, `output_${windowService.getCurrentWindowId()}_${toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '')}`);
|
||||
this.outputDir = extpath.join(environmentService.logsPath, `output_${windowService.getCurrentWindowId()}_${toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '')}`);
|
||||
|
||||
// Register as text model content provider for output
|
||||
textModelResolverService.registerTextModelContentProvider(OUTPUT_SCHEME, this);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { ISettingsEditorModel, ISearchResult } from 'vs/workbench/services/preferences/common/preferences';
|
||||
import { IEditor } from 'vs/workbench/common/editor';
|
||||
import { IKeybindingItemEntry } from 'vs/workbench/services/preferences/common/keybindingsEditorModel';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { INavigator } from 'vs/base/common/iterator';
|
||||
import { createKeybinding, ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { normalizeDriveLetter } from 'vs/base/common/labels';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { normalize } from 'vs/base/common/extpath';
|
||||
import { isWindows, OS } from 'vs/base/common/platform';
|
||||
import { repeat } from 'vs/base/common/strings';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
@@ -17,7 +17,7 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { Iterator } from 'vs/base/common/iterator';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as env from 'vs/base/common/platform';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -1085,7 +1085,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
|
||||
let folderPath: string;
|
||||
if (this.contextService.getWorkbenchState() === WorkbenchState.FOLDER) {
|
||||
// Show relative path from the root for single-root mode
|
||||
folderPath = paths.normalize(pathToRelative(workspace.folders[0].uri.fsPath, resource.fsPath));
|
||||
folderPath = extpath.normalize(pathToRelative(workspace.folders[0].uri.fsPath, resource.fsPath));
|
||||
if (folderPath && folderPath !== '.') {
|
||||
folderPath = './' + folderPath;
|
||||
}
|
||||
@@ -1097,7 +1097,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
|
||||
// If this root is the only one with its basename, use a relative ./ path. If there is another, use an absolute path
|
||||
const isUniqueFolder = workspace.folders.filter(folder => folder.name === owningRootName).length === 1;
|
||||
if (isUniqueFolder) {
|
||||
const relativePath = paths.normalize(pathToRelative(owningFolder.uri.fsPath, resource.fsPath));
|
||||
const relativePath = extpath.normalize(pathToRelative(owningFolder.uri.fsPath, resource.fsPath));
|
||||
if (relativePath === '.') {
|
||||
folderPath = `./${owningFolder.name}`;
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { IExpression } from 'vs/base/common/glob';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { URI as uri } from 'vs/base/common/uri';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
@@ -908,7 +908,7 @@ function fixPath(...slashPathParts: string[]): string {
|
||||
slashPathParts.unshift('c:');
|
||||
}
|
||||
|
||||
return paths.join(...slashPathParts);
|
||||
return extpath.join(...slashPathParts);
|
||||
}
|
||||
|
||||
function normalizeExpression(expression: IExpression | undefined): IExpression | undefined {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { basename, dirname, extname } from 'vs/base/common/paths.node';
|
||||
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { combinedDisposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { values } from 'vs/base/common/map';
|
||||
|
||||
@@ -20,7 +20,7 @@ import { IPartService, Parts, Position } from 'vs/workbench/services/part/common
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
|
||||
class PartsSplash {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
|
||||
import * as Objects from 'vs/base/common/objects';
|
||||
import * as Strings from 'vs/base/common/strings';
|
||||
import * as Assert from 'vs/base/common/assert';
|
||||
import * as Paths from 'vs/base/common/paths';
|
||||
import * as Extpath from 'vs/base/common/extpath';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
import * as UUID from 'vs/base/common/uuid';
|
||||
import * as Platform from 'vs/base/common/platform';
|
||||
@@ -188,7 +188,7 @@ export function getResource(filename: string, matcher: ProblemMatcher): URI {
|
||||
if (kind === FileLocationKind.Absolute) {
|
||||
fullPath = filename;
|
||||
} else if ((kind === FileLocationKind.Relative) && matcher.filePrefix) {
|
||||
fullPath = Paths.join(matcher.filePrefix, filename);
|
||||
fullPath = Extpath.join(matcher.filePrefix, filename);
|
||||
}
|
||||
if (fullPath === undefined) {
|
||||
throw new Error('FileLocationKind is not actionable. Does the matcher have a filePrefix? This should never happen.');
|
||||
|
||||
@@ -15,7 +15,7 @@ import { LinkedMap, Touch } from 'vs/base/common/map';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import * as TPath from 'vs/base/common/paths';
|
||||
import { isUNC } from 'vs/base/common/extpath';
|
||||
|
||||
import { win32 } from 'vs/base/node/processes';
|
||||
|
||||
@@ -735,7 +735,7 @@ export class TerminalTaskSystem implements ITaskSystem {
|
||||
}
|
||||
windowsShellArgs = true;
|
||||
let basename = path.basename(shellLaunchConfig.executable!).toLowerCase();
|
||||
if (basename === 'cmd.exe' && ((options.cwd && TPath.isUNC(options.cwd)) || (!options.cwd && TPath.isUNC(process.cwd())))) {
|
||||
if (basename === 'cmd.exe' && ((options.cwd && isUNC(options.cwd)) || (!options.cwd && isUNC(process.cwd())))) {
|
||||
return undefined;
|
||||
}
|
||||
if ((basename === 'powershell.exe') || (basename === 'pwsh.exe')) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as Collections from 'vs/base/common/collections';
|
||||
import * as Objects from 'vs/base/common/objects';
|
||||
import * as Paths from 'vs/base/common/paths';
|
||||
import * as Extpath from 'vs/base/common/extpath';
|
||||
import { CommandOptions, ErrorData, Source } from 'vs/base/common/processes';
|
||||
import * as Strings from 'vs/base/common/strings';
|
||||
import { LineData, LineProcess } from 'vs/base/node/processes';
|
||||
@@ -156,7 +156,7 @@ export class ProcessRunnerDetector {
|
||||
this._workspaceRoot = workspaceFolder;
|
||||
this._stderr = [];
|
||||
this._stdout = [];
|
||||
this._cwd = this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY ? Paths.normalize(this._workspaceRoot.uri.fsPath, true) : '';
|
||||
this._cwd = this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY ? Extpath.normalize(this._workspaceRoot.uri.fsPath, true) : '';
|
||||
}
|
||||
|
||||
public get stderr(): string[] {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { createHash } from 'crypto';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
@@ -308,8 +308,8 @@ class CachedWorkspaceConfiguration extends Disposable implements IWorkspaceConfi
|
||||
}
|
||||
|
||||
private createPaths(workspaceIdentifier: IWorkspaceIdentifier) {
|
||||
this.cachedWorkspacePath = paths.join(this.environmentService.userDataPath, 'CachedConfigurations', 'workspaces', workspaceIdentifier.id);
|
||||
this.cachedConfigurationPath = paths.join(this.cachedWorkspacePath, 'workspace.json');
|
||||
this.cachedWorkspacePath = extpath.join(this.environmentService.userDataPath, 'CachedConfigurations', 'workspaces', workspaceIdentifier.id);
|
||||
this.cachedConfigurationPath = extpath.join(this.cachedWorkspacePath, 'workspace.json');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,12 +531,12 @@ export class FileServiceBasedFolderConfiguration extends AbstractFolderConfigura
|
||||
|
||||
private toFolderRelativePath(resource: URI): string | null {
|
||||
if (resource.scheme === Schemas.file) {
|
||||
if (paths.isEqualOrParent(resource.fsPath, this.folderConfigurationPath.fsPath, !isLinux /* ignorecase */)) {
|
||||
return paths.normalize(relative(this.folderConfigurationPath.fsPath, resource.fsPath));
|
||||
if (extpath.isEqualOrParent(resource.fsPath, this.folderConfigurationPath.fsPath, !isLinux /* ignorecase */)) {
|
||||
return extpath.normalize(relative(this.folderConfigurationPath.fsPath, resource.fsPath));
|
||||
}
|
||||
} else {
|
||||
if (resources.isEqualOrParent(resource, this.folderConfigurationPath)) {
|
||||
return paths.normalize(relative(this.folderConfigurationPath.path, resource.path));
|
||||
return extpath.normalize(relative(this.folderConfigurationPath.path, resource.path));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -559,8 +559,8 @@ export class CachedFolderConfiguration extends Disposable implements IFolderConf
|
||||
configFolderRelativePath: string,
|
||||
environmentService: IEnvironmentService) {
|
||||
super();
|
||||
this.cachedFolderPath = paths.join(environmentService.userDataPath, 'CachedConfigurations', 'folders', createHash('md5').update(paths.join(folder.path, configFolderRelativePath)).digest('hex'));
|
||||
this.cachedConfigurationPath = paths.join(this.cachedFolderPath, 'configuration.json');
|
||||
this.cachedFolderPath = extpath.join(environmentService.userDataPath, 'CachedConfigurations', 'folders', createHash('md5').update(extpath.join(folder.path, configFolderRelativePath)).digest('hex'));
|
||||
this.cachedConfigurationPath = extpath.join(this.cachedFolderPath, 'configuration.json');
|
||||
this.configurationModel = new ConfigurationModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { FolderSettingsModelParser, WorkspaceConfigurationChangeEvent, StandaloneConfigurationModelParser, AllKeysConfigurationChangeEvent, Configuration } from 'vs/workbench/services/configuration/common/configurationModels';
|
||||
import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
|
||||
import { URI as uri } from 'vs/base/common/uri';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
@@ -58,7 +58,7 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
|
||||
if (!fileResource) {
|
||||
return undefined;
|
||||
}
|
||||
return paths.normalize(fileResource.fsPath, true);
|
||||
return extpath.normalize(fileResource.fsPath, true);
|
||||
},
|
||||
getSelectedText: (): string | undefined => {
|
||||
const activeTextEditorWidget = editorService.activeTextEditorWidget;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
@@ -604,5 +604,5 @@ function toResource(path: string) {
|
||||
}
|
||||
|
||||
function toFileResource(self: any, path: string) {
|
||||
return URI.file(paths.join('C:\\', Buffer.from(self.test.fullTitle()).toString('base64'), path));
|
||||
return URI.file(extpath.join('C:\\', Buffer.from(self.test.fullTitle()).toString('base64'), path));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as crypto from 'crypto';
|
||||
import * as assert from 'assert';
|
||||
import { isParent, FileOperation, FileOperationEvent, IContent, IFileService, IResolveFileOptions, IResolveFileResult, IResolveContentOptions, IFileStat, IStreamContent, FileOperationError, FileOperationResult, IUpdateContentOptions, FileChangeType, FileChangesEvent, ICreateFileOptions, IContentData, ITextSnapshot, IFilesConfiguration, IFileSystemProviderRegistrationEvent, IFileSystemProvider } from 'vs/platform/files/common/files';
|
||||
import { MAX_FILE_SIZE, MAX_HEAP_SIZE } from 'vs/platform/files/node/files';
|
||||
import { isEqualOrParent } from 'vs/base/common/paths';
|
||||
import { isEqualOrParent } from 'vs/base/common/extpath';
|
||||
import { ResourceMap } from 'vs/base/common/map';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as path from 'vs/base/common/paths.node';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as watcher from 'vs/workbench/services/files/node/watcher/common';
|
||||
@@ -233,7 +233,7 @@ export class NsfwWatcherService implements IWatcherService {
|
||||
*/
|
||||
protected _normalizeRoots(roots: IWatcherRequest[]): IWatcherRequest[] {
|
||||
return roots.filter(r => roots.every(other => {
|
||||
return !(r.basePath.length > other.basePath.length && paths.isEqualOrParent(r.basePath, other.basePath));
|
||||
return !(r.basePath.length > other.basePath.length && extpath.isEqualOrParent(r.basePath, other.basePath));
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as chokidar from 'vscode-chokidar';
|
||||
import * as fs from 'fs';
|
||||
import * as gracefulFs from 'graceful-fs';
|
||||
gracefulFs.gracefulify(fs);
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import { FileChangeType } from 'vs/platform/files/common/files';
|
||||
import { ThrottledDelayer } from 'vs/base/common/async';
|
||||
@@ -284,7 +284,7 @@ function isIgnored(path: string, requests: ExtendedWatcherRequest[]): boolean {
|
||||
if (request.basePath === path) {
|
||||
return false;
|
||||
}
|
||||
if (paths.isEqualOrParent(path, request.basePath)) {
|
||||
if (extpath.isEqualOrParent(path, request.basePath)) {
|
||||
if (!request.parsedPattern) {
|
||||
if (request.ignored && request.ignored.length > 0) {
|
||||
let pattern = `{${request.ignored.join(',')}}`;
|
||||
@@ -313,7 +313,7 @@ export function normalizeRoots(requests: IWatcherRequest[]): { [basePath: string
|
||||
for (let request of requests) {
|
||||
let basePath = request.basePath;
|
||||
let ignored = (request.ignored || []).sort();
|
||||
if (prevRequest && (paths.isEqualOrParent(basePath, prevRequest.basePath))) {
|
||||
if (prevRequest && (extpath.isEqualOrParent(basePath, prevRequest.basePath))) {
|
||||
if (!isEqualIgnore(ignored, prevRequest.ignored)) {
|
||||
result[prevRequest.basePath].push({ basePath, ignored });
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { IStringDictionary } from 'vs/base/common/collections';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { ITextModel } from 'vs/editor/common/model';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Event } from 'vs/base/common/event';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { getNLines } from 'vs/base/common/strings';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IFilesConfiguration } from 'vs/platform/files/common/files';
|
||||
@@ -371,7 +371,7 @@ export function pathIncludedInQuery(queryProps: ICommonQueryProps<URI>, fsPath:
|
||||
if (queryProps.usingSearchPaths) {
|
||||
return !!queryProps.folderQueries && queryProps.folderQueries.every(fq => {
|
||||
const searchPath = fq.folder.fsPath;
|
||||
if (paths.isEqualOrParent(fsPath, searchPath)) {
|
||||
if (extpath.isEqualOrParent(fsPath, searchPath)) {
|
||||
return !fq.includePattern || !!glob.match(fq.includePattern, fsPath);
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -13,7 +13,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import * as normalization from 'vs/base/common/normalization';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import { isEqualOrParent } from 'vs/base/common/paths';
|
||||
import { isEqualOrParent } from 'vs/base/common/extpath';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { StopWatch } from 'vs/base/common/stopwatch';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as path from 'vs/base/common/paths.node';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import { normalizeNFD } from 'vs/base/common/normalization';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { isMacintosh as isMac } from 'vs/base/common/platform';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IFileQuery, IFolderQuery } from 'vs/workbench/services/search/common/search';
|
||||
@@ -170,7 +170,7 @@ function trimTrailingSlash(str: string): string {
|
||||
}
|
||||
|
||||
export function fixDriveC(path: string): string {
|
||||
const root = paths.getRoot(path);
|
||||
const root = extpath.getRoot(path);
|
||||
return root.toLowerCase() === 'c:/' ?
|
||||
path.replace(/^c:[/\\]/i, '/') :
|
||||
path;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as assert from 'assert';
|
||||
import * as path from 'vs/base/common/paths.node';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { join, normalize } from 'vs/base/common/paths';
|
||||
import { join, normalize } from 'vs/base/common/extpath';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as nls from 'vs/nls';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { guessMimeTypes } from 'vs/base/common/mime';
|
||||
@@ -784,12 +784,12 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil
|
||||
}
|
||||
|
||||
// Check for locale file
|
||||
if (isEqual(this.resource, URI.file(path.join(this.environmentService.appSettingsHome, 'locale.json')), !isLinux)) {
|
||||
if (isEqual(this.resource, URI.file(extpath.join(this.environmentService.appSettingsHome, 'locale.json')), !isLinux)) {
|
||||
return 'locale';
|
||||
}
|
||||
|
||||
// Check for snippets
|
||||
if (isEqualOrParent(this.resource, URI.file(path.join(this.environmentService.appSettingsHome, 'snippets')))) {
|
||||
if (isEqualOrParent(this.resource, URI.file(extpath.join(this.environmentService.appSettingsHome, 'snippets')))) {
|
||||
return 'snippets';
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
@@ -908,7 +908,7 @@ export class TextFileService extends Disposable implements ITextFileService {
|
||||
// Otherwise a parent folder of the source is being moved, so we need
|
||||
// to compute the target resource based on that
|
||||
else {
|
||||
targetModelResource = sourceModelResource.with({ path: paths.join(target.path, sourceModelResource.path.substr(source.path.length + 1)) });
|
||||
targetModelResource = sourceModelResource.with({ path: extpath.join(target.path, sourceModelResource.path.substr(source.path.length + 1)) });
|
||||
}
|
||||
|
||||
// Remember as dirty target model to load after the operation
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as assert from 'assert';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { TextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textFileEditorModelManager';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { workbenchInstantiationService, TestFileService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
import { IFileService, FileChangesEvent, FileChangeType } from 'vs/platform/files/common/files';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as Paths from 'vs/base/common/paths';
|
||||
import * as Extpath from 'vs/base/common/extpath';
|
||||
import { basename } from 'vs/base/common/paths.node';
|
||||
import * as Json from 'vs/base/common/json';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
@@ -259,7 +259,7 @@ export class ColorThemeData implements IColorTheme {
|
||||
static fromExtensionTheme(theme: IThemeExtensionPoint, colorThemeLocation: URI, extensionData: ExtensionData): ColorThemeData {
|
||||
let baseTheme: string = theme['uiTheme'] || 'vs-dark';
|
||||
|
||||
let themeSelector = toCSSSelector(extensionData.extensionId + '-' + Paths.normalize(theme.path));
|
||||
let themeSelector = toCSSSelector(extensionData.extensionId + '-' + Extpath.normalize(theme.path));
|
||||
let themeData = new ColorThemeData();
|
||||
themeData.id = `${baseTheme} ${themeSelector}`;
|
||||
themeData.label = theme.label || basename(theme.path);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as assert from 'assert';
|
||||
import { join } from 'vs/base/common/paths';
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { basename } from 'vs/base/common/paths.node';
|
||||
import { ExtHostWorkspaceProvider } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { TestRPCProtocol } from './testRPCProtocol';
|
||||
import { normalize } from 'vs/base/common/paths';
|
||||
import { normalize } from 'vs/base/common/extpath';
|
||||
import { IWorkspaceFolderData } from 'vs/platform/workspace/common/workspace';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import 'vs/workbench/contrib/files/electron-browser/files.contribution'; // load our contribution into the test
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -163,7 +163,7 @@ export class TestContextService implements IWorkspaceContextService {
|
||||
}
|
||||
|
||||
public toResource(workspaceRelativePath: string): URI {
|
||||
return URI.file(paths.join('C:\\', workspaceRelativePath));
|
||||
return URI.file(extpath.join('C:\\', workspaceRelativePath));
|
||||
}
|
||||
|
||||
public isCurrentWorkspace(workspaceIdentifier: ISingleFolderWorkspaceIdentifier | IWorkspaceIdentifier): boolean {
|
||||
@@ -1476,5 +1476,5 @@ export class TestViewletService implements IViewletService {
|
||||
}
|
||||
|
||||
export function getRandomTestPath(tmpdir: string, ...segments: string[]): string {
|
||||
return paths.join(tmpdir, ...segments, generateUuid());
|
||||
return extpath.join(tmpdir, ...segments, generateUuid());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user