1 package FileLocatorFactory
;
3 # ************************************************************
4 # Description : Create FileLocator objects.
5 # Author : Chad Elliott
6 # Create Date : 11/29/2005
7 # ************************************************************
9 # ************************************************************
11 # ************************************************************
19 # ************************************************************
21 # ************************************************************
24 ## Check for Subversion first. It is unlikely that the .svn directory
25 ## will exist when Subversion isn't the rcs being used. However, that
26 ## is not the case for CVS directories.
28 ((defined $ENV{SVN_ASP_DOT_NET_HACK
} && -d
'_svn') || searchParentDirectory
('.svn'))
29 && do { return new SVNFileLocator
(); };
30 -d
'CVS' && do { return new CVSFileLocator
(); };
31 print STDERR
"WARNING: Unsupported revision control protocol\n";
34 return new FileLocator
();
37 sub searchParentDirectory
{
42 # Search all parent directories for the specified hidden
43 # directory. We stop when we either found the hidden directory
44 # of there are no more parent directories let to search.
46 if (-d
$path . '/' . $hidden) {
50 $index = rindex($path, '/');
53 $path = substr ($path, 0, $index);
55 } while ($index != -1);