fix --builtin
This commit is contained in:
parent
9bfa4c1d55
commit
e776f87e14
2 changed files with 20 additions and 12 deletions
|
@ -6,8 +6,7 @@
|
|||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
const { remote } = require('electron');
|
||||
const dialog = remote.dialog;
|
||||
const { ipcRenderer } = require('electron');
|
||||
|
||||
const builtInExtensionsPath = path.join(__dirname, '..', '..', 'product.json');
|
||||
const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json');
|
||||
|
@ -84,17 +83,13 @@ function render(el, state) {
|
|||
}
|
||||
|
||||
const localInput = renderOption(form, `local-${ext.name}`, 'Local', 'local', !!local);
|
||||
localInput.onchange = function () {
|
||||
const result = dialog.showOpenDialog(remote.getCurrentWindow(), {
|
||||
title: 'Choose Folder',
|
||||
properties: ['openDirectory']
|
||||
});
|
||||
localInput.onchange = async function () {
|
||||
const result = await ipcRenderer.invoke('pickdir');
|
||||
|
||||
if (result && result.length >= 1) {
|
||||
control[ext.name] = result[0];
|
||||
if (result) {
|
||||
control[ext.name] = result;
|
||||
setState({ builtin, control });
|
||||
}
|
||||
|
||||
setState({ builtin, control });
|
||||
};
|
||||
|
||||
if (local) {
|
||||
|
|
|
@ -3,12 +3,25 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const { app, BrowserWindow } = require('electron');
|
||||
const { app, BrowserWindow, ipcMain, dialog } = require('electron');
|
||||
const url = require('url');
|
||||
const path = require('path');
|
||||
|
||||
let window = null;
|
||||
|
||||
ipcMain.handle('pickdir', async () => {
|
||||
const result = await dialog.showOpenDialog(window, {
|
||||
title: 'Choose Folder',
|
||||
properties: ['openDirectory']
|
||||
});
|
||||
|
||||
if (result.canceled || result.filePaths.length < 1) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return result.filePaths[0];
|
||||
});
|
||||
|
||||
app.once('ready', () => {
|
||||
window = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true, webviewTag: true, enableWebSQL: false, nativeWindowOpen: true } });
|
||||
window.setMenuBarVisibility(false);
|
||||
|
|
Loading…
Reference in a new issue