File tree 2 files changed +10
-8
lines changed
2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -100,17 +100,19 @@ function createWindow() {
100
100
} ) ;
101
101
102
102
ipcMain . on ( "save" , ( evt , files ) => {
103
- const dir = appPath ;
103
+ const dir = readinPath ;
104
104
105
- const renamedCount = [ ] ;
106
-
107
- files . forEach ( ( f ) => {
108
- fs . rename ( ` ${ dir } \\ ${ f . oldName } ` , ` ${ dir } \\ ${ f . newName } ` , ( ) => {
109
- renamedCount . push ( true ) ;
105
+ const renamePromises = files . map ( ( f ) => {
106
+ return new Promise ( ( resolve ) => {
107
+ fs . rename ( ` ${ dir } / ${ f . oldName } ` , ` ${ dir } / ${ f . newName } ` , ( ) => {
108
+ resolve ( ) ;
109
+ } ) ;
110
110
} ) ;
111
111
} ) ;
112
112
113
- if ( ( renamedCount . length = files . length ) ) mainWindow . close ( ) ;
113
+ Promise . all ( renamePromises ) . then ( ( ) => {
114
+ mainWindow . close ( ) ;
115
+ } ) ;
114
116
} ) ;
115
117
116
118
ipcMain . on ( "checkUpdate" , ( evt , arg ) => {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " photolisting" ,
3
- "version" : " 0.1.1 " ,
3
+ "version" : " 0.1.2 " ,
4
4
"main" : " main.js" ,
5
5
"scripts" : {
6
6
"dev" : " cross-env NODE_ENV=dev vite" ,
You can’t perform that action at this time.
0 commit comments