Skip to content
微信公众号

应用信息定制

在VSCode源码根目录下有一个product.json文件,此文件用于配置应用的信息。

json
{
	"nameShort": "Code - OSS",
	"nameLong": "Code - OSS",
	"applicationName": "code-oss",
	"dataFolderName": ".vscode-oss",
	"win32MutexName": "vscodeoss",
	"licenseName": "MIT",
	"licenseUrl": "https://github.com/Microsoft/vscode/blob/master/LICENSE.txt",
	"win32DirName": "Microsoft Code OSS",
	"win32NameVersion": "Microsoft Code OSS",
	"win32RegValueName": "CodeOSS",
	"win32AppId": "{{E34003BB-9E10-4501-8C11-BE3FAA83F23F}",
	"win32x64AppId": "{{D77B7E06-80BA-4137-BCF4-654B95CCEBC5}",
	"win32UserAppId": "{{C6065F05-9603-4FC4-8101-B9781A25D88E}",
	"win32x64UserAppId": "{{C6065F05-9603-4FC4-8101-B9781A25D88E}",
	"win32AppUserModelId": "Microsoft.CodeOSS",
	"win32ShellNameShort": "C&ode - OSS",
	"darwinBundleIdentifier": "com.visualstudio.code.oss",
	"linuxIconName": "com.visualstudio.code.oss",
	"licenseFileName": "LICENSE.txt",
	"reportIssueUrl": "https://github.com/Microsoft/vscode/issues/new",
	"urlProtocol": "code-oss",
	"extensionAllowedProposedApi": [
		"ms-vscode.references-view"
	]
}

可以修改product.json的信息来更新定制VSCode的名称等信息。如果你在执行了./scripts/code.sh后修改了product.json的信息,比如修改了nameLong的配置,这时候重新运行./scripts/code.sh会报错。 vscode-start-error

错误信息是 ./scripts/code.sh: line 53: /Users/jiangshuaijie/Desktop/vscode-1.39.2/.build/electron/test.app/Contents/MacOS/Electron: No such file or directory ,可以看出是在code.sh中报错了,看一下code.sh中内容。

shell
...
function code() {
	cd "$ROOT"
	if [[ "$OSTYPE" == "darwin"* ]]; then
		NAME=`node -p "require('./product.json').nameLong"`
		CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
	else
		NAME=`node -p "require('./product.json').applicationName"`
		CODE=".build/electron/$NAME"
	fi
	...
	# Launch Code
	exec "$CODE" . "$@"
}
...

最终根据product.json中的nameLong来运行根目录下.build/electron/下生成的app,这时候的应用是之前生成过的,所以会报错。我们只需删除掉根目录下.build文件夹,重新执行./scripts/code.sh即可。

本站总访问量次,本站总访客数人次
Released under the MIT License.