Allow directories with white-spaces to be passed #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #62
Summary of Changes
run-clang-format.py
:normalize_paths()
to normalize backslashes in all elements of a list of file paths.split_list_arg(arg)
to split arg by regex pattern (all white spaces except those preceded by a backslash) and then normalize any backslashes usingnormalize_paths()
Testing
The modified
run-clang-format.py
file was tested on Ubuntu 18.04.6 LTS using the following command:...to replicate as many clang-format-lint arguments used in this workflow (clang-format version, inplace, extensions, excludes), and succeeds:
Processing 2 files: features/Complex Parallax Materials/Shaders/ComplexParallaxMaterials/ComplexParallaxMaterials.hlsli, src/Features/DistantTreeLighting.cpp
This of course, requires any and all whitespaces in the filepaths to be escaped by a backslash character
\
, otherwise filepaths will be broken apart just as before.E.g.:
python3 ../../clang-format-lint-action/run-clang-format.py --clang-format-executable /usr/bin/clang-format-16 --inplace "true" --extensions "h,cpp,c,hlsl,hlsli" --exclude "extern include" "features/Complex Parallax Materials/Shaders/ComplexParallaxMaterials/ComplexParallaxMaterials.hlsli src/Features/DistantTreeLighting.cpp"
will return:
I was able to test these changes locally by testing the Python script alone, but I want to try testing these changes as a GitHub Action. Is there a way I can do this?
Please let me know if additional changes are required.
Thank you for considering these changes.