Skip to content

Commit

Permalink
use less sed to unbreak macs builds (valhalla#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkreiser authored Sep 9, 2016
1 parent 8dc5ddb commit da73415
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions locales/make_locales.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@ for f in "${@}"; do
${code}"
done

#have a map to iterate over
map="$(echo "${code}" | grep -F unsigned | sed -e "s/.* \([a-zA-Z_]\+\)\[\] =.*/{\"\1\",{\1,\1+/g" -e "s/.* \([a-zA-Z_]\+\) =.*/\1}},/g" | tr -d '\n' | sed -e "s/}},{/}},\n {/g")"
for key in $(echo "${map}" | grep -F '_json"' | sed -e "s/.*{\"//g" -e "s/\",.*//g"); do
k="$(echo "${key}" | sed -e "s/_json//g" -e "s/_/-/g")"
map="$(echo "${map}" | sed -e "s/\"${key}\"/\"${k}\"/g")"
done

#output the code
echo "#include <unordered_map>"
echo "${code}"
echo "const std::unordered_map<std::string, std::string> locales_json = {";
echo " ${map}"
for f in "${@}"; do
key="${f%.*}"
var="$(echo ${f} | sed -e "s/[-.]/_/g")"
echo " {\"${key}\", {${var}, ${var} + ${var}_len}},"
done
echo "};";

#install locales locally for testing
Expand Down

0 comments on commit da73415

Please sign in to comment.