From 5fc0b74372c9a718b00a19c287897d1fb1ce5ef5 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Feb 20 2011 03:14:06 +0000 Subject: Update render_getIdentityDirOutput.sh. --- diff --git a/Scripts/Bash/Functions/Render/render_getIdentityDirOutput.sh b/Scripts/Bash/Functions/Render/render_getIdentityDirOutput.sh index 39f424e..ecf8d12 100644 --- a/Scripts/Bash/Functions/Render/render_getIdentityDirOutput.sh +++ b/Scripts/Bash/Functions/Render/render_getIdentityDirOutput.sh @@ -1,8 +1,8 @@ #!/bin/bash # -# render_getIdentityDirOutput.sh -- This function defines the absolute -# directory path of identity contents final output. This is, the place -# where content produced will be stored in. +# render_getIdentityDirOutput.sh -- This function defines the final +# absolute path the centos-art.sh script uses to store identity +# contents produced at rendition time. # # Copyright (C) 2009-2011 Alain Reguera Delgado # @@ -27,30 +27,35 @@ function render_getIdentityDirOutput { - # Define base output directory. By default rendered identity - # artworks are stored immediatly under identity entry structure. - # But if Img/ or Txt/ directory exists, use it instead. - if [[ -d ${ACTIONVAL}/Img ]]; then - OUTPUT=${ACTIONVAL}/Img - elif [[ -d ${ACTIONVAL}/Txt ]]; then - OUTPUT=${ACTIONVAL}/Txt - else - OUTPUT=${ACTIONVAL} + # Define base output directory using design model path as reference. + OUTPUT=$(dirname $FILE | sed -r \ + -e "s!/Models/${THEMEMODEL}!/Motifs/$(cli_getPathComponent "$ACTIONVAL" "--theme")!") + + # By default rendered identity content is stored immediatly under + # identity entry structure, but if `Img/' directory exists use it + # instead. + if [[ -d ${OUTPUT}/Img ]]; then + OUTPUT=${OUTPUT}/Img fi - # Define final output directory. As convenction, when we produce - # content in English language, we do not add a laguage-specific - # directory to organize content. However, when we produce content - # in a language different from English we do use language-specific - # directory to organize content. - if [[ $(cli_getCurrentLocale) =~ '^en' ]];then - OUTPUT=${OUTPUT}/$(dirname "${FILE}") - else - OUTPUT=${OUTPUT}/$(dirname "${FILE}")/$(cli_getCurrentLocale) + # Redefine base output directory to introduce specific information + # like release number, architecture, etc. + OUTPUT=${OUTPUT}/${FLAG_RELEASE}/${FLAG_ARCHITECTURE} + + # Define whether to use or not locale-specific directory to store + # content, using current locale information as reference. As + # convenction, when we produce content in English language, we do + # not add a laguage-specific directory to organize content. + # However, when we produce language-specific content in a language + # different from English we do use language-specific directory to + # organize content. + if [[ ! $(cli_getCurrentLocale) =~ '^en' ]];then + OUTPUT=${OUTPUT}/$(cli_getCurrentLocale) fi - # Remove leading `/.' string from path to final output directory. - OUTPUT=$(echo ${OUTPUT} | sed -r 's!/\.!!') + # Remove two or more consecutive slashes as well as the last + # remaining slash in the path. + OUTPUT=$(echo $OUTPUT | sed -r 's!/{2,}!/!g' | sed -r 's!/$!!') # Create final output directory, if it doesn't exist yet. if [[ ! -d ${OUTPUT} ]];then