1#!/bin/sh
2
3if [ $# -ne 2 -a $# -ne 3 ]; then
4  echo "You need to supply two arguments, e.g.:"
5  echo "$0 actions/view-file-columns ../../../../kdebase/apps/dolphin/icons/"
6  echo "...and optionally the namespace (e.g. \"ox\" or \"hi\") as third argument."
7  exit
8fi
9
10# Split the two arguments into their category and icon name parts.
11src="$1"
12src_category=${src%/*}
13src_icon=${src#*/}
14
15destdir="$2"
16
17ns="ox"
18if [ $# -eq 3 ]; then
19  ns="$3"
20fi
21
22svn add $destdir
23
24# Move the scalable icon.
25if [ -f scalable/$src.svgz ]; then
26  echo "Moving scalable/$src.svgz to $destdir/${ns}sc-$src_category-$src_icon.svgz..."
27  svn mv scalable/$src.svgz $destdir/${ns}sc-$src_category-$src_icon.svgz
28  echo
29fi
30
31# Move the optimized small versions of the icon.
32for size in 8 16 22 32 48 64 128 256; do
33  dir="${size}x${size}"
34
35  if [ -f scalable/$src_category/small/$dir/$src_icon.svgz ]; then
36    echo "Moving scalable/$src_category/small/$dir/$src_icon.svgz"
37    echo "    to $destdir/${ns}$size-$src_category-$src_icon.svgz..."
38
39    # Generate the size dir for smaller SVGs (e.g. icons/22x22/) if necessary.
40    if [ ! -d $destdir/small ]; then
41      svn mkdir $destdir/small
42    fi
43
44    svn mv scalable/$src_category/small/$dir/$src_icon.svgz $destdir/small/${ns}$size-$src_category-$src_icon.svgz
45    echo
46  fi
47done
48
49# Move the rendered PNGs.
50for size in 8 16 22 32 48 64 128 256; do
51  dir="${size}x${size}"
52
53  if [ -f $dir/$src.png ]; then
54    echo "Moving $dir/$src.png to $destdir/${ns}$size-$src_category-$src_icon.png..."
55    svn mv $dir/$src.png $destdir/${ns}$size-$src_category-$src_icon.png
56    echo
57  fi
58done
59