From fa62eb991c26b79ff5480be319fa8b1d98661e73 Mon Sep 17 00:00:00 2001 From: Lynn Date: Fri, 21 Apr 2017 16:07:36 -0700 Subject: [PATCH] add screen snippet dep for windows (#67) --- demo/index.html | 4 +- installer/Symphony-x64.aip | 834 +++++++++++++++--------------- js/screenSnippet/ScreenSnippet.js | 24 +- package.json | 3 + 4 files changed, 438 insertions(+), 427 deletions(-) diff --git a/demo/index.html b/demo/index.html index ac07b374..f137e858 100644 --- a/demo/index.html +++ b/demo/index.html @@ -42,7 +42,7 @@

-

Screen Snippet (note: currently only works on mac):

+

Screen Snippet:

snippet output:

@@ -130,7 +130,7 @@ } function snippetError(err) { - alert('error getting snippet', err); + alert('error getting snippet' + err); } }); diff --git a/installer/Symphony-x64.aip b/installer/Symphony-x64.aip index ed691a84..53a84285 100644 --- a/installer/Symphony-x64.aip +++ b/installer/Symphony-x64.aip @@ -1,417 +1,417 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/js/screenSnippet/ScreenSnippet.js b/js/screenSnippet/ScreenSnippet.js index e0a43420..af70e3bc 100644 --- a/js/screenSnippet/ScreenSnippet.js +++ b/js/screenSnippet/ScreenSnippet.js @@ -1,11 +1,13 @@ 'use strict'; +const electron = require('electron'); +const app = electron.app; const childProcess = require('child_process'); const fs = require('fs'); const os = require('os'); const path = require('path'); -const { isMac } = require('../utils/misc.js'); +const { isMac, isDevEnv } = require('../utils/misc.js'); // static ref to child process, only allow one screen snippet at time, so // hold ref to prev, so can kill before starting next snippet. @@ -43,13 +45,19 @@ class ScreenSnippet { captureUtil = '/usr/sbin/screencapture'; captureUtilArgs = [ '-i', '-s', '-t', 'jpg', outputFileName ]; } else { - // for now screen snippet on windows is not supported, - // waiting on open sourcing for custom screen snippter util. - reject(this._createWarn('windows not supported')); - // custom built windows screen capture tool, that is - // located in same directory as running exec. - //captureUtil = './ScreenSnippet.exe'; - //captureUtilArgs = [ outputFileName ]; + // use custom built windows screen capture tool + if (isDevEnv) { + // for dev env pick up tool from node nodules + captureUtil = + path.join(__dirname, + '../../node_modules/screen-snippet/bin/Release/ScreenSnippet.exe'); + } else { + // for production gets installed next to exec. + let execPath = path.dirname(app.getPath('exe')); + captureUtil = path.join(execPath, 'ScreenSnippet.exe'); + } + + captureUtilArgs = [ outputFileName ]; } // only allow one screen capture at a time. diff --git a/package.json b/package.json index 093134cd..ca2ee458 100644 --- a/package.json +++ b/package.json @@ -87,5 +87,8 @@ "keymirror": "0.1.1", "electron-context-menu": "^0.8.0", "winreg": "^1.2.3" + }, + "optionalDependencies": { + "screen-snippet": "git+ssh://github.com/symphonyoss/ScreenSnippet.git#v1.0.0" } }