Commit b9ac1f34 authored by rocosen's avatar rocosen

fix:mac

parent 1370f76b
...@@ -31,6 +31,7 @@ let siteWindown: BrowserWindow | null = null; ...@@ -31,6 +31,7 @@ let siteWindown: BrowserWindow | null = null;
let homeWindown: BrowserWindow | null = null; let homeWindown: BrowserWindow | null = null;
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isMac = process.platform === 'darwin';
const alignment = { x: 'left', y: 'up' }; const alignment = { x: 'left', y: 'up' };
const RESOURCES_PATH = app.isPackaged const RESOURCES_PATH = app.isPackaged
...@@ -43,7 +44,7 @@ const getAssetPath = (...paths: string[]): string => { ...@@ -43,7 +44,7 @@ const getAssetPath = (...paths: string[]): string => {
let image: any; let image: any;
if (process.platform === 'darwin') { if (isMac) {
image = nativeImage.createFromPath(getAssetPath('/img/iconTemplate.png')); image = nativeImage.createFromPath(getAssetPath('/img/iconTemplate.png'));
} else { } else {
image = nativeImage.createFromPath( image = nativeImage.createFromPath(
...@@ -136,11 +137,13 @@ ipcMain.on('resize-home', (event) => { ...@@ -136,11 +137,13 @@ ipcMain.on('resize-home', (event) => {
ipcMain.on('asynchronous-message', function (event, arg) { ipcMain.on('asynchronous-message', function (event, arg) {
// arg是从渲染进程返回来的数据 // arg是从渲染进程返回来的数据
const USER_HOME =( process.env.HOME || process.env.USERPROFILE) + '\\.bkunyun\\' const USER_HOME = isMac
fs.mkdir(USER_HOME,{recursive:true},(err: any) => { ? (process.env.HOME || process.env.USERPROFILE) + '/bkunyun/'
if(err) return : (process.env.HOME || process.env.USERPROFILE) + '/.bkunyun/';
fs.mkdir(USER_HOME, { recursive: true }, (err: any) => {
if (err) return;
fs.writeFile( fs.writeFile(
USER_HOME + 'roco.json' , USER_HOME + 'roco.json',
JSON.stringify(arg), JSON.stringify(arg),
'utf8', 'utf8',
(err: any) => { (err: any) => {
...@@ -151,7 +154,7 @@ ipcMain.on('asynchronous-message', function (event, arg) { ...@@ -151,7 +154,7 @@ ipcMain.on('asynchronous-message', function (event, arg) {
} }
} }
); );
}) });
}); });
ipcMain.on('window-close', (event) => { ipcMain.on('window-close', (event) => {
......
...@@ -110,12 +110,7 @@ export default (props) => { ...@@ -110,12 +110,7 @@ export default (props) => {
case '1': case '1':
return; return;
case '2': case '2':
const USER_HOME = process.env.HOME || process.env.USERPROFILE electron.ipcRenderer.send('asynchronous-message', '11111');
console.log('USER_HOME: ', USER_HOME);
electron.ipcRenderer.send(
'asynchronous-message',
'11111'
);
return; return;
case '4': case '4':
let Token = let Token =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment