#! /bin/sh
#
# This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
# http://www.gnu.org/licenses/gpl-3.0.html
#
# Copyright: 2011 Jens Lody
#
# $Revision: 10020 $
# $Id: update 10020 2014-10-30 07:40:00Z mortenmacfly $
# $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/plugins/contrib/SpellChecker/update $
#

CB_DEVEL=devel$1
CB_OUTPUT=output$1
CB_DEVEL_RESDIR=$CB_DEVEL/share/codeblocks
CB_OUTPUT_RESDIR=$CB_OUTPUT/share/codeblocks

mkdir -p "../../../${CB_DEVEL_RESDIR}/SpellChecker"
mkdir -p "../../../${CB_OUTPUT_RESDIR}/SpellChecker"
cp *.png "../../../${CB_DEVEL_RESDIR}/images/settings/"
cp *.png "../../../${CB_OUTPUT_RESDIR}/images/settings/"
cp OnlineSpellChecking.xml  "../../../${CB_DEVEL_RESDIR}/SpellChecker/"
cp OnlineSpellChecking.xml  "../../../${CB_OUTPUT_RESDIR}/SpellChecker/"

copyImageFiles() {
    from=$1
    to=$2
    echo "Copy ${from} to ${to}"

    # This is done this stupid/convoluted way, because dash/posix doesn't have arrays!
    dirs="16x16 20x20 24x24 28x28 32x32 40x40 48x48 56x56 64x64"
    echo "$dirs" | tr ' ' '\n' | while read dir; do
        echo "  Copy ${from}/${dir} to ${to}/${dir}"

        mkdir -p ${to}/${dir}
        cp -f ${from}/${dir}/*.png ${to}/${dir} > /dev/null
    done

    echo "  Copy ${from}/svg to ${to}/svg"
    mkdir -p ${to}/svg
    cp -f ${from}/svg/*.svg ${to}/svg > /dev/null
}

copyImageFiles rc ../../../${CB_DEVEL_RESDIR}/SpellChecker
copyImageFiles rc ../../../${CB_OUTPUT_RESDIR}/SpellChecker

exit 0

