Created
April 8, 2016 19:21
-
-
Save tnightingale/826758ebe271f06ac95c35c659bb70cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const fs = require('fs'), | |
path = require('path'); | |
const filestocopy = [ | |
{ | |
"res/android/drawable/logo.png": | |
"platforms/android/res/drawable-hdpi/logo.png" | |
} | |
]; | |
module.exports = function (context) { | |
const rootdir = context.opts.projectRoot; | |
return new Promise((resolve, reject) => { | |
filestocopy.forEach((obj) => { | |
Object.keys(obj).forEach((key) => { | |
const val = obj[key], | |
srcfile = path.join(rootdir, key), | |
destfile = path.join(rootdir, val), | |
destdir = path.dirname(destfile); | |
console.log("copying " + srcfile + " to " + destfile); | |
if (fs.existsSync(srcfile) && fs.existsSync(destdir)) { | |
fs.createReadStream(srcfile) | |
.on('end', () => resolve()) | |
.on('error', (e) => reject(e)) | |
.pipe(fs.createWriteStream(destfile)); | |
} | |
}); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment