X Tutup
Commit 0c4194be authored by Cosmo Myzrail Gorynych's avatar Cosmo Myzrail Gorynych 😼
Browse files

Ct.js now checks whether recovery file actually differs from the regular project file

parent 58692741
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -306,6 +306,16 @@ const openProject = async (proj: string): Promise<void | false | Promise<void>>
        void 0;
    }
    if (recoveryStat && recoveryStat.isFile()) {
        // Make sure recovery and target files are not the same
        const [recoveryContent, targetContent] = await Promise.all([
            fs.readFile(proj + '.recovery', 'utf8'),
            fs.readFile(proj, 'utf8')
        ]);
        if (recoveryContent === targetContent) {
            // Files match, load as usual
            return readProjectFile(proj);
        }
        // Files differ, ask user if they want to load the recovery file
        const targetStat = await fs.stat(proj);
        const voc = getLanguageJSON().intro.recovery;
        const userResponse = await window.alertify
X Tutup