Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
netdisc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rocosen
netdisc
Commits
1370f76b
Commit
1370f76b
authored
Dec 05, 2022
by
rocosen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:写入文件
parent
364b555d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
main.ts
src/main/main.ts
+15
-16
head.jsx
src/renderer/components/head.jsx
+3
-2
No files found.
src/main/main.ts
View file @
1370f76b
...
...
@@ -134,25 +134,24 @@ ipcMain.on('resize-home', (event) => {
});
});
// 主进程
// path.join(__dirname, '../renderer/data/data.json'),
ipcMain
.
on
(
'asynchronous-message'
,
function
(
event
,
arg
)
{
// arg是从渲染进程返回来的数据
fs
.
writeFile
(
resolveHtmlPath
(
'/data/roco.json'
),
JSON
.
stringify
(
arg
),
'utf8'
,
(
err
:
any
)
=>
{
if
(
err
)
{
event
.
sender
.
send
(
'asynchronous-reply'
,
'写入失败'
);
// alert('222222');
}
else
{
event
.
sender
.
send
(
'asynchronous-reply'
,
'写入成功'
);
// alert('111111');
const
USER_HOME
=
(
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
)
+
'
\\
.bkunyun
\
\'
fs.mkdir(USER_HOME,{recursive:true},(err: any) => {
if(err) return
fs.writeFile(
USER_HOME + '
roco
.
json
' ,
JSON.stringify(arg),
'
utf8
',
(err: any) => {
if (err) {
event.sender.send('
asynchronous
-
reply
', '
写入失败
');
} else {
event.sender.send('
asynchronous
-
reply
', '
写入成功
');
}
}
}
);
);
})
});
ipcMain.on('
window
-
close
', (event) => {
...
...
src/renderer/components/head.jsx
View file @
1370f76b
...
...
@@ -110,10 +110,11 @@ export default (props) => {
case
'1'
:
return
;
case
'2'
:
console
.
log
(
'2222222222222222222222'
);
const
USER_HOME
=
process
.
env
.
HOME
||
process
.
env
.
USERPROFILE
console
.
log
(
'USER_HOME: '
,
USER_HOME
);
electron
.
ipcRenderer
.
send
(
'asynchronous-message'
,
'
传递回去ping
'
'
11111
'
);
return
;
case
'4'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment