/var/lib/sorcery/modules/url_handlers/url_file
1 #!/bin/bash
2 #---------------------------------------------------------------------
3 ##
4 ## @Synopsis Url handler functions for grabbing file urls.
5 ## This file contains functions for I<downloading> (actually it just
6 ## copies) files which can be accessed through the local file system.
7 ## Url's of this type are specified using the format
8 ##
9 ## file://<path>
10 ##
11 ## where <path> is the full path to the file.
12 ##
13 ## @Copyright Copyright 2002 by the Source Mage Team
14 ##
15 #---------------------------------------------------------------------
16
17 #---------------------------------------------------------------------
18 ## @param url
19 ##
20 ## Verifies the specified file exists. Returns true if the file exists
21 ## OR if the file is an empty string.
22 ##
23 #---------------------------------------------------------------------
24 function url_file_verify() {
25 FILENAME=`url_file_strip_prefix $1`
26 if [[ "$FILENAME" ]] ; then
27 [ -f "$FILENAME" ] &&
28 [ -r "$FILENAME" ]
29 fi
30 }
31
32 #---------------------------------------------------------------------
33 ##=back
34 ##
35 ##=head1 LICENSE
36 ##
37 ## This software is free software; you can redistribute it and/or modify
38 ## it under the terms of the GNU General Public License as published by
39 ## the Free Software Foundation; either version 2 of the License, or
40 ## (at your option) any later version.
41 ##
42 ## This software is distributed in the hope that it will be useful,
43 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
44 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 ## GNU General Public License for more details.
46 ##
47 ## You should have received a copy of the GNU General Public License
48 ## along with this software; if not, write to the Free Software
49 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
50 ##
51 #---------------------------------------------------------------------