2016-05-20 11:52:08 +00:00
|
|
|
const fs = require('fs-extra');
|
|
|
|
const path = require('path');
|
|
|
|
const groupFilesByType = require('../groupFilesByType');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies each file from an array of assets provided to targetPath directory
|
|
|
|
*
|
|
|
|
* For now, the only types of files that are handled are:
|
|
|
|
* - Fonts (otf, ttf) - copied to targetPath/fonts under original name
|
|
|
|
*/
|
|
|
|
module.exports = function unlinkAssetsAndroid(files, targetPath) {
|
2017-09-22 12:41:32 +00:00
|
|
|
const assets = groupFilesByType(files);
|
2016-05-20 11:52:08 +00:00
|
|
|
|
2017-09-22 12:41:32 +00:00
|
|
|
(assets.font || []).forEach((file) => {
|
|
|
|
const filePath = path.join(targetPath, 'fonts', path.basename(file));
|
|
|
|
if (fs.existsSync(filePath)) {
|
|
|
|
fs.unlinkSync(filePath);
|
2016-05-20 11:52:08 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|