GT2/GT2-iOS/node_modules/react-native/local-cli/link/android/unlinkAssets.js

21 lines
644 B
JavaScript
Raw Normal View History

2018-02-12 17:26:06 +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) {
const assets = groupFilesByType(files);
(assets.font || []).forEach((file) => {
const filePath = path.join(targetPath, 'fonts', path.basename(file));
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
}
});
};