From 72097022781d67cbceb3298723efc0d8761fc678 Mon Sep 17 00:00:00 2001 From: Kevin Hartman Date: Sun, 23 May 2021 22:33:45 -0400 Subject: [PATCH] Use path.join when logging screenshot path. (#29211) Remove index.html from offscreen-rendering tutorial. It is not used. Update offscreen-rendering.md to reflect changes to fiddle. --- .../features/offscreen-rendering/index.html | 15 --------------- docs/fiddles/features/offscreen-rendering/main.js | 3 ++- docs/tutorial/offscreen-rendering.md | 6 +----- 3 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 docs/fiddles/features/offscreen-rendering/index.html diff --git a/docs/fiddles/features/offscreen-rendering/index.html b/docs/fiddles/features/offscreen-rendering/index.html deleted file mode 100644 index 0da80aefd88a..000000000000 --- a/docs/fiddles/features/offscreen-rendering/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - Hello World! - - - -

Hello World!

-

- We are using node , - Chrome , - and Electron . -

- - diff --git a/docs/fiddles/features/offscreen-rendering/main.js b/docs/fiddles/features/offscreen-rendering/main.js index 38bbb991a2d0..10ad35d3d9a8 100644 --- a/docs/fiddles/features/offscreen-rendering/main.js +++ b/docs/fiddles/features/offscreen-rendering/main.js @@ -1,5 +1,6 @@ const { app, BrowserWindow } = require('electron') const fs = require('fs') +const path = require('path') app.disableHardwareAcceleration() @@ -12,7 +13,7 @@ app.whenReady().then(() => { fs.writeFileSync('ex.png', image.toPNG()) }) win.webContents.setFrameRate(60) - console.log(`The screenshot has been successfully saved to ${process.cwd()}/ex.png`) + console.log(`The screenshot has been successfully saved to ${path.join(process.cwd(), 'ex.png')}`) }) app.on('window-all-closed', () => { diff --git a/docs/tutorial/offscreen-rendering.md b/docs/tutorial/offscreen-rendering.md index 8a8d4d77b315..ce8009f46f2f 100644 --- a/docs/tutorial/offscreen-rendering.md +++ b/docs/tutorial/offscreen-rendering.md @@ -39,10 +39,6 @@ To enable this mode, GPU acceleration has to be disabled by calling the ## Example -Starting with a working application from the -[Quick Start Guide](quick-start.md), add the following lines to the -`main.js` file: - ```javascript fiddle='docs/fiddles/features/offscreen-rendering' const { app, BrowserWindow } = require('electron') const fs = require('fs') @@ -63,5 +59,5 @@ app.whenReady().then(() => { ``` After launching the Electron application, navigate to your application's -working folder. +working folder, where you'll find the rendered image. [disablehardwareacceleration]: ../api/app.md#appdisablehardwareacceleration