src/preferences/PreferencesBase.js
function (newData) {
            var result = new $.Deferred();
            var path = this.path;
            var prefFile = FileSystem.getFileForPath(path);

            if (path) {
                try {
                    var text = JSON.stringify(newData, null, 4);

                    // maintain the original line endings
                    text = FileUtils.translateLineEndings(text, this._lineEndings);
                    prefFile.write(text, {}, function (err) {
                        if (err) {
                            result.reject("Unable to save prefs at " + path + " " + err);
                        } else {
                            result.resolve();
                        }
                    });
                } catch (e) {
                    result.reject("Unable to convert prefs to JSON" + e.toString());
                }
            } else {
                result.resolve();
            }
            return result.promise();
        }
function (newData) {
            var result = new $.Deferred();
            var path = this.path;
            var prefFile = FileSystem.getFileForPath(path);

            if (path) {
                try {
                    var text = JSON.stringify(newData, null, 4);

                    // maintain the original line endings
                    text = FileUtils.translateLineEndings(text, this._lineEndings);
                    prefFile.write(text, {}, function (err) {
                        if (err) {
                            result.reject("Unable to save prefs at " + path + " " + err);
                        } else {
                            result.resolve();
                        }
                    });
                } catch (e) {
                    result.reject("Unable to convert prefs to JSON" + e.toString());
                }
            } else {
                result.resolve();
            }
            return result.promise();
        }
function ( newData ) { var result = new $ . Deferred ( ) ; var path = this . path ; var prefFile = FileSystem . getFileForPath ( path ) ; if ( path ) { try { var text = JSON . stringify ( newData , null , 4 ) ; // maintain the original line endings text = FileUtils . translateLineEndings ( text , this . _lineEndings ) ; prefFile . write ( text , { } , function ( err ) { if ( err ) { result . reject ( "Unable to save prefs at " + path + " " + err ) ; } else { result . resolve ( ) ; } } ) ; } catch ( e ) { result . reject ( "Unable to convert prefs to JSON" + e . toString ( ) ) ; } } else { result . resolve ( ) ; } return result . promise ( ) ; }
Saves the new data to disk.

@param {Object} newData data to save
@return {Promise} Promise resolved (with no arguments) once the data has been saved
Saves the new data to disk .