Skip to content

Commit

Permalink
Tracy尝试2个路径;不再提示Tracy未启用
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Oct 23, 2024
1 parent 40ddeff commit c39537d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/mainMenu/pages/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ function 多开模式() {

function 启用Tracy() {
let node = new TreeNode('启用Tracy', {
description: '下次编辑器更新后可用',
tooltip: '对Lua进行性能分析,但是会大幅影响运行效率',
checkboxState: config.tracy ? vscode.TreeItemCheckboxState.Checked : vscode.TreeItemCheckboxState.Unchecked,
onDidChangeCheckboxState(state) {
Expand Down
24 changes: 16 additions & 8 deletions src/tools/tracy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@ import * as y3 from 'y3-helper';
import * as vscode from 'vscode';
import { runShell } from '../runShell';

let paths = [
'../LocalData/Patch/ExternalResource/tracy/Tracy.exe',
'../Package/ExternalResource/tracy/Tracy.exe',
];

export async function launch() {
if (!y3.env.editorUri) {
return false;
}
const tracyUri = vscode.Uri.joinPath(y3.env.editorUri, '../LocalData/Patch/ExternalResource/tracy/Tracy.exe');
if (!await y3.fs.isExists(tracyUri)) {
return false;
}
const code = await runShell('启动 Tracy', `${tracyUri.fsPath}`, [
"-a", "127.0.0.1",
]);
for (let path of paths) {
const tracyUri = vscode.Uri.joinPath(y3.env.editorUri, path);
if (!await y3.fs.isExists(tracyUri)) {
continue;
}
const code = await runShell('启动 Tracy', `${tracyUri.fsPath}`, [
"-a", "127.0.0.1",
]);

return code === 0;
return code === 0;
}
return false;
}

0 comments on commit c39537d

Please sign in to comment.