mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Fix Docker wrapper to handle relative paths
This commit is contained in:
parent
f24f500750
commit
bd3b8186b9
21
.github/workflows/format-check-new.yml
vendored
21
.github/workflows/format-check-new.yml
vendored
@ -14,8 +14,25 @@ jobs:
|
|||||||
- name: Setup clang-format Docker alias
|
- name: Setup clang-format Docker alias
|
||||||
run: |
|
run: |
|
||||||
# Create a wrapper script for clang-format that uses Docker
|
# Create a wrapper script for clang-format that uses Docker
|
||||||
echo '#!/bin/bash' | sudo tee /usr/local/bin/clang-format
|
cat > /tmp/clang-format-wrapper << 'EOF'
|
||||||
echo 'docker run --rm -i -v "$PWD":"$PWD" -w "$PWD" silkeh/clang:18 clang-format "$@"' | sudo tee -a /usr/local/bin/clang-format
|
#!/bin/bash
|
||||||
|
# Convert relative paths to absolute paths and run clang-format in Docker
|
||||||
|
args=()
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [[ "$arg" == /* ]] || [[ "$arg" == -* ]]; then
|
||||||
|
# Absolute path or option, use as-is
|
||||||
|
args+=("$arg")
|
||||||
|
elif [[ -e "$arg" ]]; then
|
||||||
|
# Relative path that exists, convert to absolute
|
||||||
|
args+=("$(realpath "$arg")")
|
||||||
|
else
|
||||||
|
# Not a file path, use as-is
|
||||||
|
args+=("$arg")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
docker run --rm -i -v "$PWD":"$PWD" -w "$PWD" silkeh/clang:18 clang-format "${args[@]}"
|
||||||
|
EOF
|
||||||
|
sudo mv /tmp/clang-format-wrapper /usr/local/bin/clang-format
|
||||||
sudo chmod +x /usr/local/bin/clang-format
|
sudo chmod +x /usr/local/bin/clang-format
|
||||||
# Verify version
|
# Verify version
|
||||||
clang-format --version
|
clang-format --version
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user