Blame Scripts/Bash/Functions/cli_getRepoParallelDirs.sh

328582
#!/bin/bash
328582
#
179346
# cli_getRepoParallelDirs.sh -- This function returns the parallel
179346
# directories related to the first positional paramenter passed as
179346
# parent directory. 
328582
#
e6e90a
# Copyright (C) 2009-2011 Alain Reguera Delgado
328582
# 
72c8a5
# This program is free software; you can redistribute it and/or
72c8a5
# modify it under the terms of the GNU General Public License as
72c8a5
# published by the Free Software Foundation; either version 2 of the
72c8a5
# License, or (at your option) any later version.
328582
# 
328582
# This program is distributed in the hope that it will be useful, but
328582
# WITHOUT ANY WARRANTY; without even the implied warranty of
328582
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
328582
# General Public License for more details.
328582
#
328582
# You should have received a copy of the GNU General Public License
328582
# along with this program; if not, write to the Free Software
328582
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
328582
# USA.
328582
# 
328582
# ----------------------------------------------------------------------
328582
# $Id$
328582
# ----------------------------------------------------------------------
328582
179346
function cli_getRepoParallelDirs {
328582
179346
    local BOND=''
179346
    local TDIR=''
179346
    local -a PDIRS
328582
179346
    # Define bond string using first positional parameter as
179346
    # reference.
179346
    if [[ "$1" != '' ]];then
179346
        BOND="$1"
179346
    elif [[ "$ACTIONVAL" != '' ]];then
179346
        BOND="$ACTIONVAL"
179346
    else
179346
        cli_printMessage "cli_getRepoParallelDirs: `gettext "The bond string is required."`" 'AsErrorLine'
179346
        cli_printMessage "$(caller)" 'AsToKnowMoreLine'
179346
    fi
328582
179346
    # Define repository top level directory.
179346
    TDIR=$(cli_getRepoTLDir ${BOND})
328582
179346
    # Define parallel directory base structures.
179346
    PDIRS[0]=Manual/$(cli_getCurrentLocale)/Texinfo/Repository/$(cli_getRepoTLDir "${BOND}" '--relative')
179346
    PDIRS[1]=Scripts/Bash/Functions/Render/Config
179346
    PDIRS[2]=Translations
179346
179346
    # Redefine bond string without its top level directory structure.
e6e90a
    BOND=$(echo $BOND | sed -r "s,^${TDIR}/(.+)$,\1,")
179346
179346
    # Concatenate repository top level directory, parallel directory
179346
    # base structure, and bond information; in order to produce the
179346
    # final parallel directory path.
e6e90a
    for PDIR in "${PDIRS[@]}";do
179346
        echo ${TDIR}/${PDIR}/${BOND}
179346
    done
328582
328582
}