Skip to content

Commit

Permalink
🔧 Do not use inplace sed as it works differently on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Schneegans committed Dec 24, 2024
1 parent 0f25fbe commit bd584b2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions icons/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ add_margin_to_svg() {
scale=$(echo "($size - 2 * $margin) / $size" | bc -l)

# Insert a <g> after the <svg> line using sed.
sed -i='' "/^<svg.*/a <g transform=\"translate($margin, $margin) scale($scale) \">" "$svg"
sed -e "/^<svg.*/a <g transform=\"translate($margin, $margin) scale($scale) \">" "$svg" > "$TMP_DIR/tmp.svg"
mv "$TMP_DIR/tmp.svg" "$svg"

# Append the closing </g> tag before the final </svg> line using sed.
sed -i='' '$i </g>' "$svg"
sed -e '$i </g>' "$svg" > "$TMP_DIR/tmp.svg"
mv "$TMP_DIR/tmp.svg" "$svg"
}

# Converts an SVG to a PNG of the specified size.
Expand Down

0 comments on commit bd584b2

Please sign in to comment.