File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/node_requires/resources/projects Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -306,6 +306,16 @@ const openProject = async (proj: string): Promise<void | false | Promise<void>>
306
306
void 0 ;
307
307
}
308
308
if ( recoveryStat && recoveryStat . isFile ( ) ) {
309
+ // Make sure recovery and target files are not the same
310
+ const [ recoveryContent , targetContent ] = await Promise . all ( [
311
+ fs . readFile ( proj + '.recovery' , 'utf8' ) ,
312
+ fs . readFile ( proj , 'utf8' )
313
+ ] ) ;
314
+ if ( recoveryContent === targetContent ) {
315
+ // Files match, load as usual
316
+ return readProjectFile ( proj ) ;
317
+ }
318
+ // Files differ, ask user if they want to load the recovery file
309
319
const targetStat = await fs . stat ( proj ) ;
310
320
const voc = getLanguageJSON ( ) . intro . recovery ;
311
321
const userResponse = await window . alertify
You can’t perform that action at this time.
0 commit comments