Blame Scripts/Functions/Render/render_checkSvgAbsref.sh

540e8b
#!/bin/bash
540e8b
#
ab1d67
# render_checkSvgAbsref.sh -- This function retrives absolute files
d7e760
# and checks their existence. In order for design templates to point
d7e760
# different artistic motifs, design templates make use of external
d7e760
# files that point to specific artistic motif background images. If
d7e760
# such external files doesn't exist, print a message and stop script
d7e760
# execution.  We cannot continue without background information.
540e8b
#
540e8b
# Copyright (C) 2009-2011 Alain Reguera Delgado
540e8b
# 
540e8b
# This program is free software; you can redistribute it and/or
540e8b
# modify it under the terms of the GNU General Public License as
540e8b
# published by the Free Software Foundation; either version 2 of the
540e8b
# License, or (at your option) any later version.
540e8b
# 
540e8b
# This program is distributed in the hope that it will be useful, but
540e8b
# WITHOUT ANY WARRANTY; without even the implied warranty of
540e8b
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
540e8b
# General Public License for more details.
540e8b
#
540e8b
# You should have received a copy of the GNU General Public License
540e8b
# along with this program; if not, write to the Free Software
540e8b
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
540e8b
# USA.
540e8b
# 
540e8b
# ----------------------------------------------------------------------
540e8b
# $Id$
540e8b
# ----------------------------------------------------------------------
540e8b
ab1d67
function render_checkSvgAbsref {
540e8b
540e8b
    local FILE=''
540e8b
    local ABSPATHS=''
8fe0e1
    local ABSPATH=''
540e8b
540e8b
    # Define absolute path of file we need to retrive absolute paths
540e8b
    # from.
540e8b
    FILE="$1"
540e8b
540e8b
    # Verify existence of file we need to retrive absolute paths from.
540e8b
    cli_checkFiles $FILE 'f'
540e8b
540e8b
    # Retrive absolute paths from file.
426953
    ABSPATHS=$(egrep "(sodipodi:absref|xlink:href)=\"${HOME}.+" $FILE \
3cb7a2
        | sed -r "s,.+=\"(${HOME}.+\.png)\".*,\1,")
540e8b
540e8b
    # Verify absolute paths retrived from file.
8fe0e1
    for ABSPATH in $ABSPATHS;do
8fe0e1
        cli_checkFiles "$ABSPATH" 'f'
540e8b
    done
540e8b
540e8b
}