added normalize_paths() to normalize backslashes in all elements of a list of file paths.
I originally considered using os.path.normpath but wasn't able to use it to normalize the backslashes
extended split_list_arg(arg) to split arg by regex pattern (all white spaces except those preceded by a backslash) and then normalize any backslashes using normalize_paths()
Testing
The modified run-clang-format.py file was tested on Ubuntu 18.04.6 LTS using the following command:
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.:
Processing 4 files: features/Complex, Parallax, Materials/Shaders/ComplexParallaxMaterials/ComplexParallaxMaterials.hlsli, src/Features/DistantTreeLighting.cpp
run-clang-format.py: error: [Errno 2] No such file or directory: 'Parallax'
run-clang-format.py: error: [Errno 2] No such file or directory: 'features/Complex'
run-clang-format.py: error: [Errno 2] No such file or directory: 'Materials/Shaders/ComplexParallaxMaterials/ComplexParallaxMaterials.hlsli'
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.
Thanks, I am using https://github.com/DoozyX/test-action to test the action, can have the code copied from this repo as local action and test it using that one.
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:
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.: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.