2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-10 11:22:12 +00:00

Minor refactorings.

[SVN r21200]
This commit is contained in:
Vladimir Prus
2003-12-10 08:10:13 +00:00
parent 6a9b3e32b2
commit ccb28e2feb
2 changed files with 15 additions and 6 deletions

View File

@@ -545,13 +545,12 @@ class file-reference : abstract-target
[ virtual-target.from-file $(self.name) : $(self.project) ] ;
}
rule location ( )
# Returns true if the referred file really exists;
rule exists ( )
{
# FIXME: use of glob seems like a horribly inefficient way
# to lookup a file.
local location = [ path.root $(self.name)
[ project.attribute $(self.project) source-location ] ] ;
return [ path.glob $(location:D) : $(location:D=) ] ;
[ project.attribute $(self.project) source-location ] ] ;
return [ path.exists $(location) ] ;
}
}
@@ -615,7 +614,7 @@ rule find ( id : current-location )
if ! $(target) && ! $(have-project-reference) && $(base-project)
{
target = [ new file-reference $(target-part) : $(base-project) ] ;
if ! [ $(target).location ]
if ! [ $(target).exists ]
{
# File actually does not exist.
# Reset 'target' so that an error is issued.

View File

@@ -195,6 +195,16 @@ rule glob ( dir : patterns + )
return [ sequence.transform make : [ GLOB [ native $(dir) ] : $(patterns) ] ] ;
}
#
# Returns true is the specified file exists.
#
rule exists ( file )
{
return [ path.glob $(file:D) : $(file:D=) ] ;
}
#
# Find out the absolute name of path and returns the list of all the parents,
# starting with the immediate one. Parents are returned as relative names.