src/extensions/default/AutoUpdate/StateHandler.js
function _write(filePath, json) {
        var result = $.Deferred(),
            _file = FileSystem.getFileForPath(filePath);

        if (_file) {

            var content = JSON.stringify(json);
            FileUtils.writeText(_file, content, true)
                .done(function () {
                    result.resolve();
                })
                .fail(function (err) {
                    result.reject();
                });

        } else {
            result.reject();
        }

        return result.promise();
    }
function _write(filePath, json) {
        var result = $.Deferred(),
            _file = FileSystem.getFileForPath(filePath);

        if (_file) {

            var content = JSON.stringify(json);
            FileUtils.writeText(_file, content, true)
                .done(function () {
                    result.resolve();
                })
                .fail(function (err) {
                    result.reject();
                });

        } else {
            result.reject();
        }

        return result.promise();
    }
function _write ( filePath , json ) { var result = $ . Deferred ( ) , _file = FileSystem . getFileForPath ( filePath ) ; if ( _file ) { var content = JSON . stringify ( json ) ; FileUtils . writeText ( _file , content , true ) . done ( function ( ) { result . resolve ( ) ; } ) . fail ( function ( err ) { result . reject ( ) ; } ) ; } else { result . reject ( ) ; } return result . promise ( ) ; }
Performs the write of JSON object to a file.
@param   {string} filepath - path to JSON file
@param   {object} json  - JSON object to write
@returns {$.Deferred} - a jquery deferred promise,
that is resolved with the write success or failure
Performs the write of JSON object to a file .