12345678910111213141516171819202122232425262728293031323334 |
- const OS = require('os');
- const { exec } = require('child_process');
- const Msg = Editor.require('packages://hot-update-tools/panel/msg.js');
- const Fs = require('fs');
- const Electron = require('electron');
- module.exports = {
- methods: {
- log (str) {
- this.$root.$emit(Msg.Log, str);
- },
- openDir (path) {
- if (!Fs.existsSync(path)) {
- return;
- }
- let cmd = '';
- switch (OS.platform()) {
- case 'win32': {
- cmd = `start "" "${path}"`;
- break;
- }
- case 'darwin': {
- cmd = `open "${path}"`;
- break;
- }
- }
- if (cmd) {
- exec(cmd);
- } else {
- Electron.remote.shell.showItemInFolder(path);
- }
- Electron.remote.shell.beep();
- },
- },
- };
|