/**
 * Write a file unless exists.
 * @function task.worker._writeFileUnlessExists
 * @param {string} filename - Filename to write
 * @param {string} content - Content to write.
 * @param {function} callback - Callback when done.
 * @protected
 * @ignore
 * @author Taka Okunishi
 */
var fs = require('fs');

module.exports = function (filename, content, callback) {
    fs.exists(filename, function (exists) {
        if (exists) {
            callback(null);
            return;
        }
        fs.writeFile(filename, content, function (err) {
            callback(err);
        });
    });
};