Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TheBiggerGuy/b6222bd4784b264dbd00411a654f537c to your computer and use it in GitHub Desktop.
Save TheBiggerGuy/b6222bd4784b264dbd00411a654f537c to your computer and use it in GitHub Desktop.
Fix Windows vs. Linux/OSX/POSIX case sensitive filename issues with Microsoft .NET resource files (resx)
#!/bin/bash
set -o errexit # Exit on most errors (see the manual)
set -o errtrace # Make sure any error trap is inherited
set -o nounset # Disallow expansion of unset variables
set -o pipefail # Use last non-zero exit code in a pipeline
#set -o xtrace # Trace the execution of the script (debug)
root="${PWD}"
for resfile in */*.resx ; do
resfilereal=$(realpath ${resfile})
resfiledir=$(dirname ${resfile})
echo "Found Resex file ${resfile}" #(resfilereal=${resfilereal} resfiledir=${resfiledir}"
cd "${resfiledir}"
find * -type f -print0 | sed -e 's/\//\\\/\\\//g' | sed -e 's/\./\\\\./g' | xargs -0 --no-run-if-empty --replace="." -I{} sed --in-place 's/>{};/>{};/gI' "${resfilereal}"
cd "${root}"
dos2unix "${resfilereal}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment