function createTextFile(path, text, fileSystem) {
        var deferred = new $.Deferred(),
            file = fileSystem.getFileForPath(path),
            options = {
                blind: true // overwriting previous files is OK
            };

        file.write(text, options, function (err) {
            if (!err) {
                deferred.resolve(file);
            } else {
                deferred.reject(err);
            }
        });

        return deferred.promise();
    }
Create or overwrite a text file
@param {!string} path Path for a file to be created/overwritten
@param {!string} text Text content for the new file
@param {!FileSystem} fileSystem FileSystem instance to use. Normally, use the instance from
     testWindow so the test copy of Brackets is aware of the newly-created file.
@return {$.Promise} A promise resolved when the file is written or rejected when an error occurs.