portable dev-tool
This commit is contained in:
parent
c028846dd3
commit
635076d45a
@ -62,6 +62,22 @@ async function createWindow() {
|
||||
// 然后显示窗口
|
||||
mainWindow.show();
|
||||
|
||||
// 添加:在便携模式下自动打开开发者工具
|
||||
// 检查是否为便携模式(检查可执行文件同级目录是否有portable.txt文件)
|
||||
try {
|
||||
const exePath = app.getPath('exe');
|
||||
const appDir = path.dirname(exePath);
|
||||
const portableFlagPath = path.join(appDir, 'portable.txt');
|
||||
|
||||
// 如果存在portable.txt文件,则为便携模式,打开开发者工具
|
||||
if (fs.existsSync(portableFlagPath)) {
|
||||
console.log('检测到便携模式,打开开发者工具');
|
||||
mainWindow.webContents.openDevTools();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('检查便携模式时出错:', error);
|
||||
}
|
||||
|
||||
// 添加窗口关闭事件监听
|
||||
mainWindow.on("close", (event) => {
|
||||
console.log("检测到窗口关闭事件");
|
||||
|
@ -134,10 +134,10 @@ function buildPortableApp() {
|
||||
console.log(`- dist_electron/`);
|
||||
console.log(` - portable-app/`);
|
||||
console.log(` - StatExamPortable_${require('./package.json').version}_*.exe`);
|
||||
console.log(` - data/`);
|
||||
console.log(` - system.db`);
|
||||
console.log(` - user.db`);
|
||||
console.log(` - .gitignore`);
|
||||
console.log(` - data/`);
|
||||
console.log(` - system.db`);
|
||||
console.log(` - user.db`);
|
||||
console.log(` - .gitignore`);
|
||||
|
||||
} catch (error) {
|
||||
console.error('构建失败:', error);
|
||||
|
Loading…
Reference in New Issue
Block a user