diff --git a/src/main.ts b/src/main.ts index 075ce29..4550355 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,6 +5,7 @@ import DSHome from './home'; import RemoteContainer, { openProjectWithoutLogging } from './remote-container'; import User from './user'; import DevstarAPIHandler from './devstar-api'; +import * as utils from './utils'; export class DevStarExtension { user: User; @@ -83,6 +84,14 @@ export class DevStarExtension { this.registerGlobalCommands(context); + if (vscode.env.remoteName === undefined) { + // 如果处于local,且localSystemName未存储,则存储 + const localSystemName = utils.getLocalSystemName(context) + if (localSystemName === undefined || localSystemName === "") { + utils.updateLocalSystemName(context) + } + } + this.startDevStarHome(); } diff --git a/src/utils.ts b/src/utils.ts index ad1e4e4..effa0ee 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -115,4 +115,14 @@ export async function showErrorNotification(message: string): Promise { } else if (selection === 'Report a problem') { vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://gitee.com/SuperIDE/DevStar/issues')); } +} + +export function updateLocalSystemName(context: vscode.ExtensionContext) { + // win32, linux, darwin + const name = os.platform() + context.globalState.update('localSystemName', name) +} + +export function getLocalSystemName(context: vscode.ExtensionContext): string | undefined { + return context.globalState.get('localSystemName') } \ No newline at end of file