fix throwing error screen before loading update
This commit is contained in:
@@ -108,22 +108,29 @@ export function foundationIpcRegistration(mainWindow: BrowserWindow) {
|
||||
});
|
||||
|
||||
ipcMain.on('window-resize', (_, { width, height }) => {
|
||||
const { x: currentX, y: currentY, width: currentWidth, height: currentHeight } = mainWindow.getBounds();
|
||||
const { x: currentX, y: currentY } = mainWindow.getBounds();
|
||||
|
||||
const newX = currentX + (currentWidth - width) / 2;
|
||||
const newY = currentY + (currentHeight - height) / 2;
|
||||
const display = screen.getDisplayMatching(mainWindow.getBounds());
|
||||
const displayBounds = display.workArea;
|
||||
|
||||
const { width: screenWidth, height: screenHeight } = screen.getPrimaryDisplay().workAreaSize;
|
||||
let newX = currentX;
|
||||
let newY = currentY;
|
||||
|
||||
const clampedX = Math.max(0, Math.min(newX, screenWidth - width));
|
||||
//const clampedY = Math.max(0, Math.min(newY, screenHeight - height));
|
||||
if (currentX + width > displayBounds.x + displayBounds.width) {
|
||||
newX = displayBounds.x + displayBounds.width - width;
|
||||
}
|
||||
|
||||
if (currentY + height > displayBounds.y + displayBounds.height) {
|
||||
newY = displayBounds.y + displayBounds.height - height;
|
||||
}
|
||||
|
||||
mainWindow.setBounds({
|
||||
x: Math.round(clampedX),
|
||||
//y: Math.round(clampedY),
|
||||
width,
|
||||
height,
|
||||
x: newX,
|
||||
y: newY,
|
||||
width: width,
|
||||
height: height
|
||||
});
|
||||
mainWindow.webContents.send('window-state-changed');
|
||||
});
|
||||
|
||||
ipcMain.on('window-resizeble', (_, isResizeble) => {
|
||||
|
||||
@@ -15,6 +15,13 @@ ipcMain.handleOnce('report-boot-process-failed', async () => {
|
||||
* приложение попыталось загрузиться в режиме разработки.
|
||||
*/
|
||||
let filePath = path.join(WORKING_DIR, 'b');
|
||||
if(!await existsFile(filePath)){
|
||||
/**
|
||||
* Исправление ошибки когда директории нет.
|
||||
*/
|
||||
logger.log("No compiled files to remove");
|
||||
return;
|
||||
}
|
||||
await fs.rmdir(filePath, { recursive: true });
|
||||
logger.log("Boot process failed, removed compiled files");
|
||||
logger.log(`Removed compiled files at ${filePath}`);
|
||||
|
||||
Reference in New Issue
Block a user