Blame Scripts/Bash/Functions/Render/render_getIdentityDirOutput.sh

4c79b5
#!/bin/bash
4c79b5
#
f59354
# render_getIdentityDirOutput.sh -- This function defines the absolute
f59354
# directory path of identity contents final output. This is, the place
f59354
# where content produced will be stored in.
4c79b5
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
4c79b5
# 
7cd8e9
# This program is free software; you can redistribute it and/or
7cd8e9
# modify it under the terms of the GNU General Public License as
7cd8e9
# published by the Free Software Foundation; either version 2 of the
7cd8e9
# License, or (at your option) any later version.
4c79b5
# 
4c79b5
# This program is distributed in the hope that it will be useful, but
4c79b5
# WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
4c79b5
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4c79b5
# USA.
4c79b5
# 
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
6523cc
function render_getIdentityDirOutput {
4c79b5
f59354
    # Define base output directory. By default rendered identity
f59354
    # artworks are stored immediatly under identity entry structure.
07c2fe
    # But if Img/ or Txt/ directory exists, use it instead.
f59354
    if [[ -d ${ACTIONVAL}/Img ]]; then
f59354
        OUTPUT=${ACTIONVAL}/Img
f59354
    elif [[ -d ${ACTIONVAL}/Txt ]]; then
f59354
        OUTPUT=${ACTIONVAL}/Txt
f59354
    else
f59354
        OUTPUT=${ACTIONVAL}
f59354
    fi
f59354
f59354
    # Define final output directory. As convenction, when we produce
f59354
    # content in English language, we do not add a laguage-specific
f59354
    # directory to organize content.  However, when we produce content
f59354
    # in a language different from English we do use language-specific
f59354
    # directory to organize content.
f59354
    if [[ $(cli_getCurrentLocale) =~ '^en' ]];then
f59354
        OUTPUT=${OUTPUT}/$(dirname "${FILE}")
f59354
    else
f59354
        OUTPUT=${OUTPUT}/$(dirname "${FILE}")/$(cli_getCurrentLocale)
f59354
    fi
f59354
f59354
    # Remove leading `/.' string from path to final output directory.
f59354
    OUTPUT=$(echo ${OUTPUT} | sed -r 's!/\.!!')
f59354
f59354
    # Create final output directory, if it doesn't exist yet.
f59354
    if [[ ! -d ${OUTPUT} ]];then
f59354
        mkdir -p ${OUTPUT}
4c79b5
    fi
4c79b5
4c79b5
}