fix: SDA-1948: write snippet image to user data directory temp folder (#967)

* SDA-1948: write snippet image to user data directory temp folder

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* SDA-1948: set tmp dir for tests

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>
This commit is contained in:
Vishwas Shashidhar 2020-04-07 16:05:52 +05:30 committed by GitHub
parent 45f3a2f33e
commit e1a0acdb4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ import * as path from 'path';
import { ChildProcess, ExecException, execFile } from 'child_process';
import * as util from 'util';
import { IScreenSnippet } from '../common/api-interface';
import { isDevEnv, isLinux, isMac, isWindowsOS } from '../common/env';
import { isDevEnv, isElectronQA, isLinux, isMac, isWindowsOS } from '../common/env';
import { i18n } from '../common/i18n';
import { logger } from '../common/logger';
import { updateAlwaysOnTop } from './window-actions';
@ -25,7 +25,14 @@ class ScreenSnippet {
private shouldUpdateAlwaysOnTop: boolean = false;
constructor() {
this.tempDir = os.tmpdir();
if (isElectronQA) {
this.tempDir = os.tmpdir();
} else {
this.tempDir = path.join(app.getPath('userData'), 'temp');
if (!fs.existsSync(this.tempDir)) {
fs.mkdirSync(this.tempDir);
}
}
this.captureUtil = isMac ? '/usr/sbin/screencapture' : isDevEnv
? path.join(__dirname,
'../../../node_modules/screen-snippet/ScreenSnippet.exe')