-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathshim.js
More file actions
34 lines (30 loc) · 736 Bytes
/
Copy pathshim.js
File metadata and controls
34 lines (30 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { Platform } = require('obsidian');
function hasBin(bin) {
if(Platform.isDesktop) {
const hasBin = require('hasbin');
return hasBin.sync(bin);
} else {
return false;
}
}
function nodeExec(bin, cb) {
if(Platform.isDesktop) {
const childProcess = require('child_process');
return childProcess.exec(bin, cb);
} else {
throw new Error('platform not supported');
}
}
function clipboardReadText() {
if(Platform.isDesktop) {
const electron = require('electron');
return electron.clipboard.readText();
} else {
throw new Error('platform not supported');
}
}
module.exports = {
hasBin,
nodeExec,
clipboardReadText
}