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
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# 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
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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
}