Windshaft-cartodb/lib/cartodb/utils/icu_data_env_setter.js
2018-01-11 12:22:51 +01:00

20 lines
599 B
JavaScript

'use strict';
const glob = require('glob');
const path = require('path');
// See https://github.com/CartoDB/support/issues/984
// CartoCSS properties text-wrap-width/text-wrap-character not working
function setICUEnvVariable() {
if (process.env.ICU_DATA === undefined) {
const regexedPath = '/node_modules/mapnik/lib/binding/*/share/mapnik/icu/';
const directory = glob.sync(path.join(__dirname, '../../..', regexedPath));
if (directory && directory.length > 0) {
process.env.ICU_DATA = directory[0];
}
}
}
module.exports = setICUEnvVariable;