diff --git a/run-clang-format.sh b/run-clang-format.sh index 6f9fc0c80..656c738c6 100755 --- a/run-clang-format.sh +++ b/run-clang-format.sh @@ -18,12 +18,11 @@ # ! -path "soh/assets/*" # asset headers are autogenerated, don't fight them # -# | sed 's| |\\ |g' -# pipe the result of find into sed to -# ensure all the paths returned by find have spaces escaped +# -print0 +# separate paths with NUL bytes, avoiding issues with spaces in paths # -# | xargs clang-format-14 -i +# | xargs -0 clang-format-14 -i # use xargs to take each path we've found # and pass it as an argument to clang-format -find soh -type f \( -name "*.c" -o -name "*.cpp" -o \( -name "*.h" ! -path "soh/src/**.h" ! -path "soh/include/**.h" \) \) ! -path "soh/assets/*" | sed 's| |\\ |g' | xargs clang-format-14 -i +find soh -type f \( -name "*.c" -o -name "*.cpp" -o \( -name "*.h" ! -path "soh/src/**.h" ! -path "soh/include/**.h" \) \) ! -path "soh/assets/*" -print0 | xargs -0 clang-format-14 -i