From ddd5a9ae79b905fef7b50db226ca8e149d2d069f Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 21 Aug 2019 17:02:31 -0500 Subject: [PATCH] Update data and extension paths to match version one To ensure users don't lose their extensions when updating. --- src/cli.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 848451543..99d6cf849 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,5 +1,6 @@ import * as cp from "child_process"; import * as os from "os"; +import * as path from "path"; import { setUnexpectedErrorHandler } from "vs/base/common/errors"; import { main as vsCli } from "vs/code/node/cliProcessMain"; import { validatePaths } from "vs/code/node/paths"; @@ -73,7 +74,15 @@ const getArgs = (): Args => { options.push(last); - return validatePaths(parseMainProcessArgv(process.argv)); + const args = parseMainProcessArgv(process.argv); + if (!args["user-data-dir"]) { + args["user-data-dir"] = path.join(process.env.XDG_DATA_HOME || path.join(os.homedir(), ".local/share"), "code-server"); + } + if (!args["extensions-dir"]) { + args["extensions-dir"] = path.join(args["user-data-dir"], "extensions"); + } + + return validatePaths(args); }; const startVscode = async (): Promise => {