Fix issues with configuration directories
- Move the old data directory if possible. - Fix extension path to not use a hard-coded path and instead use the data directory. - Create every part of the path during startup. - Create each path when a connection is made as well in case they are deleted while the server is running. - Create every part of the path before saving settings or writing a file using the resource endpoint.
This commit is contained in:
@@ -1,26 +1,37 @@
|
||||
import { InitData } from "@coder/protocol";
|
||||
import { IProductConfiguration } from "vs/platform/product/node/product";
|
||||
|
||||
const product = {
|
||||
nameShort: "code-server",
|
||||
nameLong: "code-server",
|
||||
dataFolderName: ".code-server",
|
||||
extensionsGallery: {
|
||||
class Product implements IProductConfiguration {
|
||||
public nameShort = "code-server";
|
||||
public nameLong = "code-server";
|
||||
|
||||
private _dataFolderName: string | undefined;
|
||||
public get dataFolderName(): string {
|
||||
if (!this._dataFolderName) {
|
||||
throw new Error("trying to access data folder name before it has been set");
|
||||
}
|
||||
|
||||
return this._dataFolderName;
|
||||
}
|
||||
|
||||
public extensionsGallery = {
|
||||
serviceUrl: global && global.process && global.process.env.SERVICE_URL
|
||||
|| process.env.SERVICE_URL
|
||||
|| "https://v1.extapi.coder.com",
|
||||
},
|
||||
extensionExecutionEnvironments: {
|
||||
};
|
||||
|
||||
public extensionExecutionEnvironments = {
|
||||
"wayou.vscode-todo-highlight": "worker",
|
||||
"vscodevim.vim": "worker",
|
||||
"coenraads.bracket-pair-colorizer": "worker",
|
||||
},
|
||||
fetchUrl: "",
|
||||
} as IProductConfiguration;
|
||||
};
|
||||
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
product.nameShort += ' Dev';
|
||||
product.nameLong += ' Dev';
|
||||
product.dataFolderName += '-dev';
|
||||
public fetchUrl = "";
|
||||
|
||||
public initialize(_data: InitData): void {
|
||||
// Nothing at the moment; dataFolderName isn't used since we override the
|
||||
// extension path.
|
||||
}
|
||||
}
|
||||
|
||||
export default product;
|
||||
export default new Product();
|
||||
|
||||
Reference in New Issue
Block a user