app/js/main/bwa/fileinput.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 31
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 20
mnd 0
bc 0
fnc 1
dl 0
loc 31
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
// jshint esversion: 8
2
3
const electron = require('electron'),
4
  debug = require('debug')('main.bwa.fileinput');
5
6
const {
7
  app,
8
  BrowserWindow,
9
  Menu,
10
  ipcMain,
11
  dialog
12
} = electron;
13
14
/*
15
  ipcMain.on('bwa:input.file', function(...) {...});
16
    File input, select file dialog
17
  parameters
18
    event
19
 */
20
ipcMain.on('bwa:input.file', function(event) {
21
  var {
22
    sender
23
  } = event;
24
25
  debug("Waiting for file selection");
26
  var filePath = dialog.showOpenDialogSync({
27
    title: "Select wordlist file",
28
    buttonLabel: "Open",
29
    properties: ['openFile', 'showHiddenFiles']
30
  });
31
  debug("Using selected file at {0}".format(filePath));
32
  sender.send('bwa:fileinput.confirmation', filePath);
33
});
34
35
/*
36
// On drag and drop file
37
ipcMain.on('ondragstart', function(event, filePath) {
38
  event.sender.startDrag({
39
    file: filePath,
40
    icon: appSettings.window.icon
41
  });
42
  debug('File drag filepath: {0}'.format(filePath));
43
  event.sender.send('bwa:fileinput.confirmation', filePath, true);
44
});
45
*/
46