Skip to content

Commit 878fc83

Browse files
authored
Update copy-libs.sh
1 parent d4074fb commit 878fc83

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

tools/copy-libs.sh

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -388,13 +388,21 @@ fi
388388
# Füge Include-Verkürzung aus REL_INC hinzu
389389
if [[ -n "$REL_INC" ]]; then
390390
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\")," >> "$AR_PLATFORMIO_PY"
391-
# Konvertiere -iwithprefixbefore zu -iwithprefix
391+
# Verarbeite REL_INC korrekt - Flag und Pfad sind getrennt
392392
IFS=' ' read -ra rel_inc_array <<< "$REL_INC"
393-
for flag in "${rel_inc_array[@]}"; do
394-
if [[ "$flag" == "-iwithprefixbefore"* ]]; then
395-
# Konvertiere zu -iwithprefix
396-
converted_flag="${flag//-iwithprefixbefore/-iwithprefix}"
397-
echo " \"$converted_flag\"," >> "$AR_PLATFORMIO_PY"
393+
i=0
394+
while [ $i -lt ${#rel_inc_array[@]} ]; do
395+
if [[ "${rel_inc_array[$i]}" == "-iwithprefixbefore" ]]; then
396+
# Nächstes Element ist der Pfad
397+
if [ $((i+1)) -lt ${#rel_inc_array[@]} ]; then
398+
path="${rel_inc_array[$((i+1))]}"
399+
echo " \"-iwithprefix/include/$path\"," >> "$AR_PLATFORMIO_PY"
400+
i=$((i+2)) # Überspringe Flag und Pfad
401+
else
402+
i=$((i+1))
403+
fi
404+
else
405+
i=$((i+1))
398406
fi
399407
done
400408
fi
@@ -445,13 +453,21 @@ done
445453
# Füge Include-Verkürzung aus REL_INC hinzu
446454
if [[ -n "$REL_INC" ]]; then
447455
echo " \"-iprefix\", join(FRAMEWORK_DIR, \"tools\", \"sdk\", \"$IDF_TARGET\")," >> "$AR_PLATFORMIO_PY"
448-
# Konvertiere -iwithprefixbefore zu -iwithprefix
456+
# Verarbeite REL_INC korrekt - Flag und Pfad sind getrennt
449457
IFS=' ' read -ra rel_inc_array <<< "$REL_INC"
450-
for flag in "${rel_inc_array[@]}"; do
451-
if [[ "$flag" == "-iwithprefixbefore"* ]]; then
452-
# Konvertiere zu -iwithprefix
453-
converted_flag="${flag//-iwithprefixbefore/-iwithprefix}"
454-
echo " \"$converted_flag\"," >> "$AR_PLATFORMIO_PY"
458+
i=0
459+
while [ $i -lt ${#rel_inc_array[@]} ]; do
460+
if [[ "${rel_inc_array[$i]}" == "-iwithprefixbefore" ]]; then
461+
# Nächstes Element ist der Pfad
462+
if [ $((i+1)) -lt ${#rel_inc_array[@]} ]; then
463+
path="${rel_inc_array[$((i+1))]}"
464+
echo " \"-iwithprefix/include/$path\"," >> "$AR_PLATFORMIO_PY"
465+
i=$((i+2)) # Überspringe Flag und Pfad
466+
else
467+
i=$((i+1))
468+
fi
469+
else
470+
i=$((i+1))
455471
fi
456472
done
457473
fi

0 commit comments

Comments
 (0)