Skip to content

Commit 934d4a8

Browse files
committed
Update screenshot.js
Allow for potential Windows support in the future.
1 parent a297f56 commit 934d4a8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/components/screenshot.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
const childProcess = require('child_process')
2121

2222
const fs = require('fs')
23+
const os = require('os')
2324

2425
const config = require('../config')
2526
const utils = require('./utils')
@@ -134,7 +135,15 @@ module.exports = class {
134135
execute (dir, callback) {
135136
const name = utils.getTimestamp()
136137
const output = `${dir}/${name}.png`
137-
const command = `screencapture -i -x ${output}`
138+
139+
let command
140+
141+
if (os.platform() === 'darwin') command = `screencapture -i -x ${output}`
142+
if (os.platform() === 'win32') {
143+
const binary = '../../app/bin/boxcutter.exe'
144+
145+
command = `${binary} "${output}"`
146+
}
138147

139148
console.log('Capturing selection...')
140149

@@ -143,7 +152,9 @@ module.exports = class {
143152
console.log('Selection captured!')
144153
return callback(output)
145154
}
155+
146156
console.log('Error while capturing!')
157+
147158
return callback(null, true)
148159
})
149160
}

0 commit comments

Comments
 (0)