mirror of
https://github.com/responsively-org/responsively-app
synced 2024-11-10 14:54:12 +00:00
Possible screenshot path error fixed
This commit is contained in:
parent
464f81492f
commit
1ae8e60e04
2 changed files with 3 additions and 5 deletions
|
@ -12,7 +12,7 @@ import path from 'path';
|
|||
import { app, BrowserWindow, shell, ipcMain, screen } from 'electron';
|
||||
import { autoUpdater } from 'electron-updater';
|
||||
import log from 'electron-log';
|
||||
import { IPC_MAIN_CHANNELS } from 'common/constants';
|
||||
import { IPC_MAIN_CHANNELS } from '../common/constants';
|
||||
import MenuBuilder from './menu';
|
||||
import { resolveHtmlPath } from './util';
|
||||
import { BROWSER_SYNC_HOST, initInstance } from './browser-sync';
|
||||
|
|
|
@ -2,6 +2,7 @@ import { Device } from 'common/deviceList';
|
|||
import { ipcMain, shell, webContents } from 'electron';
|
||||
import { writeFile, ensureDir } from 'fs-extra';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
|
||||
export interface ScreenshotArgs {
|
||||
webContentsId: number;
|
||||
|
@ -18,10 +19,7 @@ const quickScreenshot = async (
|
|||
): Promise<ScreenshotResult> => {
|
||||
const { webContentsId } = arg;
|
||||
const image = await webContents.fromId(webContentsId).capturePage();
|
||||
const dir = path.join(
|
||||
process.env.HOME || '.',
|
||||
`/Desktop/Responsively-Screenshots`
|
||||
);
|
||||
const dir = path.join(os.homedir(), `Desktop/Responsively-Screenshots`);
|
||||
const filePath = path.join(dir, `/screenshot-${Date.now()}.jpeg`);
|
||||
await ensureDir(dir);
|
||||
await writeFile(filePath, image.toJPEG(100));
|
||||
|
|
Loading…
Reference in a new issue