fix: use robust loop for idempotent header patching to avoid find -exec syntax errors

This commit is contained in:
Timothy Hofland
2026-03-13 12:47:33 +01:00
parent 6380b8325d
commit 01da5b6044

View File

@ -269,11 +269,13 @@ find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/std::std::/s
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/\([^:a-zA-Z0-9]\)unique_ptr\b/\1std::unique_ptr/g' {} +
find src -type f \( -name "*.h" -o -name "*.cpp" \) -exec sed -i 's/\([^:a-zA-Z0-9]\)make_unique\b/\1std::make_unique/g' {} +
# Add memory header only if not present
find src -type f -name "*.h" -exec grep -q "<memory>" {} || sed -i '1i #include <memory>' {} +
# 3. Fix missing algorithms (std::find, etc)
find src -type f -name "*.cpp" -exec grep -q "<algorithm>" {} || sed -i '1i #include <algorithm>' {} +
# Add headers only if not present
for f in $(find src -type f -name "*.h"); do
grep -q "<memory>" "$f" || sed -i '1i #include <memory>' "$f"
done
for f in $(find src -type f -name "*.cpp"); do
grep -q "<algorithm>" "$f" || sed -i '1i #include <algorithm>' "$f"
done
# Build Example (Force C++17 for better compatibility with this addon)
cd "$REAL_HOME/openFrameworks/addons/ofxPiMapper/example_basic"