templates/hooks/after_prepare/icons_and_splashscreens.js
function copyFile (src, dest, ncpOpts, callback) {
  var orchestrator = new Orchestrator();
  var parts = dest.split(path.sep);
  var fileName = parts.pop();
  var destDir = parts.join(path.sep);
  var destFile = path.resolve(destDir, fileName);
  orchestrator.add('ensureDir', function (done) {
    mkdirp(destDir, function (err) {
      done(err);
    });
  });
  orchestrator.add('copyFile', ['ensureDir'], function (done) {
    ncp(src, destFile, ncpOpts, function (err) {
      done(err);
    });
  });
  orchestrator.start('copyFile', function (err) {
    callback(err);
  });
}
function copyFile (src, dest, ncpOpts, callback) {
  var orchestrator = new Orchestrator();
  var parts = dest.split(path.sep);
  var fileName = parts.pop();
  var destDir = parts.join(path.sep);
  var destFile = path.resolve(destDir, fileName);
  orchestrator.add('ensureDir', function (done) {
    mkdirp(destDir, function (err) {
      done(err);
    });
  });
  orchestrator.add('copyFile', ['ensureDir'], function (done) {
    ncp(src, destFile, ncpOpts, function (err) {
      done(err);
    });
  });
  orchestrator.start('copyFile', function (err) {
    callback(err);
  });
}
function copyFile ( src , dest , ncpOpts , callback ) { var orchestrator = new Orchestrator ( ) ; var parts = dest . split ( path . sep ) ; var fileName = parts . pop ( ) ; var destDir = parts . join ( path . sep ) ; var destFile = path . resolve ( destDir , fileName ) ; orchestrator . add ( 'ensureDir' , function ( done ) { mkdirp ( destDir , function ( err ) { done ( err ) ; } ) ; } ) ; orchestrator . add ( 'copyFile' , [ 'ensureDir' ] , function ( done ) { ncp ( src , destFile , ncpOpts , function ( err ) { done ( err ) ; } ) ; } ) ; orchestrator . start ( 'copyFile' , function ( err ) { callback ( err ) ; } ) ; }
Helper function for file copying that ensures directory existence.
Helper function for file copying that ensures directory existence .