1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-27 20:55:25 +00:00

Set workspace and folder URIs

This makes the file tree work.
This commit is contained in:
Asher 2019-07-02 10:59:36 -05:00
parent 7072bf1e83
commit d808bfaec6
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -6,6 +6,7 @@ import * as util from "util";
import * as url from "url";
import { Emitter } from "vs/base/common/event";
import { sanitizeFilePath } from "vs/base/common/extpath";
import { getMediaMime } from "vs/base/common/mime";
import { extname } from "vs/base/common/path";
import { UriComponents, URI } from "vs/base/common/uri";
@ -139,7 +140,8 @@ export class Server {
);
}
const requestPath = url.parse(request.url || "").pathname || "/";
const parsedUrl = url.parse(request.url || "", true);
const requestPath = parsedUrl.pathname || "/";
if (requestPath === "/") {
const htmlPath = path.join(
this.rootPath,
@ -151,8 +153,14 @@ export class Server {
const remoteAuthority = request.headers.host as string;
const transformer = getUriTransformer(remoteAuthority);
const cwd = process.env.VSCODE_CWD || process.cwd();
const workspacePath = parsedUrl.query.workspace as string | undefined;
const folderPath = !workspacePath ? parsedUrl.query.folder as string | undefined || cwd: undefined;
const options: Options = {
WORKBENCH_WEB_CONGIGURATION: {
workspaceUri: workspacePath ? transformer.transformOutgoing(URI.file(sanitizeFilePath(workspacePath, cwd))) : undefined,
folderUri: folderPath ? transformer.transformOutgoing(URI.file(sanitizeFilePath(folderPath, cwd))) : undefined,
remoteAuthority,
},
REMOTE_USER_DATA_URI: transformer.transformOutgoing(this.environmentService.webUserDataHome),