string ResolvePath ( string path, IEnumerable<string> dirs )
{
if (path==null) {
throw new ArgumentNullException("path");
}
if ( Path.IsPathRooted( path ) ) {
if (File.Exists( path )) {
return path;
} else {
throw new BuildException(string.Format("Path '{0}' not resolved", path));
}
}
//
// make search list :
//
foreach ( var dir in dirs ) {
//Log.Message("...{0}", dir );
var fullPath = Path.GetFullPath( Path.Combine( dir, path ) );
if ( File.Exists( fullPath ) ) {
return fullPath;
}
}
throw new BuildException(string.Format("Path '{0}' not resolved", path));
}