Files
electron-egg/electron/apis/example.js
2020-12-23 19:28:50 +08:00

29 lines
597 B
JavaScript

'use strict';
const path = require('path');
const { app, shell } = require('electron');
exports.getPath = function () {
const dir = app.getAppPath();
ELog.info('dir:', dir);
return dir;
}
exports.openDir = function (dir = 'D:/www/xing/electron-egg') {
if (!dir) {
return false;
}
dir = getElectronPath(dir);
shell.openItem(dir);
return true;
}
function getElectronPath (filepath) {
filepath = path.resolve(filepath);
filepath=filepath.replace("resources","");
filepath=filepath.replace("app.asar","");
filepath = path.normalize(filepath);
return filepath;
};