File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -47,12 +47,14 @@ export interface IElectronAPI {
47
47
writeFile : (
48
48
path : string ,
49
49
data : string | Uint8Array
50
- ) => ReturnType < fs . writeFile >
51
- readdir : ( path : string ) => ReturnType < fs . readdir >
52
- exists : ( path : string ) => ReturnType < fs . exists >
50
+ ) => ReturnType < typeof fs . writeFile >
51
+ readdir : ( path : string ) => Promise < string [ ] >
52
+ // This is synchronous.
53
+ exists : ( path : string ) => boolean
53
54
getPath : ( name : string ) => Promise < string >
54
55
rm : typeof fs . rm
55
- stat : ( path : string ) => ReturnType < fs . stat >
56
+ // TODO: Use a real return type.
57
+ stat : ( path : string ) => Promise < any >
56
58
statIsDirectory : ( path : string ) => Promise < boolean >
57
59
canReadWriteDirectory : (
58
60
path : string
@@ -61,7 +63,7 @@ export interface IElectronAPI {
61
63
mkdir : typeof fs . mkdir
62
64
join : typeof path . join
63
65
sep : typeof path . sep
64
- rename : ( prev : string , next : string ) => typeof fs . rename
66
+ rename : ( prev : string , next : string ) => ReturnType < typeof fs . rename >
65
67
packageJson : {
66
68
name : string
67
69
}
Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ export const FileMachineProvider = ({
294
294
}
295
295
}
296
296
297
- window . electron . rename ( oldPath , newPath )
297
+ await window . electron . rename ( oldPath , newPath )
298
298
299
299
if ( ! file ) {
300
300
return Promise . reject ( new Error ( 'file is not defined' ) )
Original file line number Diff line number Diff line change @@ -457,7 +457,7 @@ export const systemIOMachineDesktop = systemIOMachine.provide({
457
457
}
458
458
}
459
459
460
- window . electron . rename ( oldPath , newPath )
460
+ await window . electron . rename ( oldPath , newPath )
461
461
462
462
return {
463
463
message : `Successfully renamed folder "${ folderName } " to "${ requestedFolderName } "` ,
@@ -523,7 +523,7 @@ export const systemIOMachineDesktop = systemIOMachine.provide({
523
523
}
524
524
}
525
525
526
- window . electron . rename ( oldPath , newPath )
526
+ await window . electron . rename ( oldPath , newPath )
527
527
528
528
return {
529
529
message : `Successfully renamed file "${ fileNameWithExtension } " to "${ requestedFileNameWithExtension } "` ,
You can’t perform that action at this time.
0 commit comments