lib/safeFile.js
function safeRecover (fileName) {
    verifyFileName (fileName);

    // if fileName exists, verify it is a file
    var info = getFileInfo (fileName);
    if ((info.exists) && (info.isFile === false)) {
        var message1 = format (cc.MSG_IS_NOT_A_FILE, fileName);
        throw new SafeFileError (cc.IS_NOT_A_FILE, message1);
    }

    // get state, if doesn't exist throw error
    var state = getState (fileName);
    if (state.status === cc.DOES_NOT_EXIST) {
        var message2 = format (cc.MSG_DOES_NOT_EXIST, fileName);
        throw new SafeFileError (cc.DOES_NOT_EXIST, message2);
    }
        
    performRecovery (state, true);
}
function safeRecover (fileName) {
    verifyFileName (fileName);

    // if fileName exists, verify it is a file
    var info = getFileInfo (fileName);
    if ((info.exists) && (info.isFile === false)) {
        var message1 = format (cc.MSG_IS_NOT_A_FILE, fileName);
        throw new SafeFileError (cc.IS_NOT_A_FILE, message1);
    }

    // get state, if doesn't exist throw error
    var state = getState (fileName);
    if (state.status === cc.DOES_NOT_EXIST) {
        var message2 = format (cc.MSG_DOES_NOT_EXIST, fileName);
        throw new SafeFileError (cc.DOES_NOT_EXIST, message2);
    }
        
    performRecovery (state, true);
}
function safeRecover ( fileName ) { verifyFileName ( fileName ) ; // if fileName exists, verify it is a file var info = getFileInfo ( fileName ) ; if ( ( info . exists ) && ( info . isFile === false ) ) { var message1 = format ( cc . MSG_IS_NOT_A_FILE , fileName ) ; throw new SafeFileError ( cc . IS_NOT_A_FILE , message1 ) ; } // get state, if doesn't exist throw error var state = getState ( fileName ) ; if ( state . status === cc . DOES_NOT_EXIST ) { var message2 = format ( cc . MSG_DOES_NOT_EXIST , fileName ) ; throw new SafeFileError ( cc . DOES_NOT_EXIST , message2 ) ; } performRecovery ( state , true ) ; }
Initiate auto-recovery processing.
@param {String} fileName Name of base file
@throws SafeFileError
Initiate auto - recovery processing .