/
githubmirror
/
hyper
Обзор
Документация
Войти
/
githubmirror
/
hyper
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v3.1.4
lib/utils/paste.ts
27 строк
773 B
Labhansh Agrawal
Fix ts errors in lib/utils
13 окт 2019, 04:39
13 окт 2019, 04:39
d2a318d
Код
Авторство
О чём код?
import {clipboard} from 'electron'; import plist from 'plist'; const getPath = (platform: string) => { switch (platform) { case 'darwin': { if (clipboard.has('NSFilenamesPboardType')) { // Parse plist file containing the path list of copied files const list = plist.parse(clipboard.read('NSFilenamesPboardType')) as plist.PlistArray; return "'" + list.join("' '") + "'"; } else { return null; } } case 'win32': { const filepath = clipboard.read('FileNameW'); return filepath.replace(new RegExp(String.fromCharCode(0), 'g'), ''); } // Linux already pastes full path default: return null; } }; export default function processClipboard() { return getPath(process.platform); }