Blame Scripts/Bash/Functions/Commons/cli_getTemporalFile.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# cli_getTemporalFile.sh -- This function returns the absolute path
878a2b
# you need to use to create temporal files. Use this function whenever
878a2b
# you need to create temporal files inside centos-art.sh script.
878a2b
#
878a2b
# Copyright (C) 2009, 2010, 2011 The CentOS Project
878a2b
#
878a2b
# This program is free software; you can redistribute it and/or modify
878a2b
# it under the terms of the GNU General Public License as published by
878a2b
# the Free Software Foundation; either version 2 of the License, or (at
878a2b
# your option) any later version.
878a2b
#
878a2b
# This program is distributed in the hope that it will be useful, but
878a2b
# WITHOUT ANY WARRANTY; without even the implied warranty of
878a2b
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
878a2b
# General Public License for more details.
878a2b
#
878a2b
# You should have received a copy of the GNU General Public License
878a2b
# along with this program; if not, write to the Free Software
878a2b
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
878a2b
#
878a2b
# ----------------------------------------------------------------------
878a2b
# $Id$
878a2b
# ----------------------------------------------------------------------
878a2b
878a2b
function cli_getTemporalFile {
878a2b
878a2b
    # Define base name for temporal file. This is required when svg
878a2b
    # instances are created previous to be parsed by inkscape in order
878a2b
    # to be exported as png. In such cases .svg file exention is
878a2b
    # required in order to avoid complains from inkscape.
878a2b
    local NAME="$(cli_getRepoName $1 -f)"
878a2b
878a2b
    # Check default base name for temporal file, it can't be an empty
878a2b
    # value.
878a2b
    if [[ "$NAME" == '' ]];then
878a2b
        cli_printMessage "`gettext "The first argument cannot be empty."`" --as-error-line
878a2b
    fi
878a2b
ab534e
    # Define absolute path for temporal file. 
6ab59e
    local TEMPFILE="${CLI_TEMPDIR}/${NAME}"
878a2b
878a2b
    # Output absolute path to final temporal file.
878a2b
    echo $TEMPFILE
878a2b
878a2b
}