#!/bin/bash

#Invert slashes from back slash to forward slash
sed -i 's/\\/\//g' "@MINGW_PREFIX@/etc/gnuradio/conf.d/grc.conf"

#Make global_blocks_path use windows directory naming using cygpath
gbp=$(grep global_blocks_path "@MINGW_PREFIX@/etc/gnuradio/conf.d/grc.conf");
gbpv=$(printf '%s\n' "${gbp}" | cut -d = -f2);
replace_gbpv=$(cygpath.exe -w $gbpv);
escaped_replace_gbpv=$(printf '%s\n' "${replace_gbpv}" | sed -e 's/[]\/$*.^[]/\\&/g');
sed -i 's@'"${gbpv}"'@'\ ${escaped_replace_gbpv}'@' "@MINGW_PREFIX@/etc/gnuradio/conf.d/grc.conf"

#Make examples_path use windows directory naming using cygpath
ep=$(grep examples_path "@MINGW_PREFIX@/etc/gnuradio/conf.d/grc.conf");
epv=$(printf '%s\n' "${ep}" | cut -d = -f2);
replace_epv=$(cygpath.exe -w $epv);
escaped_replace_epv=$(printf '%s\n' "${replace_epv}" | sed -e 's/[]\/$*.^[]/\\&/g');
sed -i 's@'"${epv}"'@'\ ${escaped_replace_epv}'@' "@MINGW_PREFIX@/etc/gnuradio/conf.d/grc.conf"
