/**
  * Search for a file and walk up the path if not found in current dir.
  *
  * @param 	string 		$fileName File name to search for
  * @param 	string 		$path Path to search for file
  * @param 	boolean 	$walkUp If set it will be searched for the file in folders above the given
  * @param 	string 		$basePath This absolute path is the limit for searching with $walkUp
  * @return	string 		file content
  */
 function tools_findFileInPath($fileName, $path, $walkUp = true, $basePath = '')
 {
     $basePath = $basePath ? $basePath : PATH_site;
     $path = tx_dam::path_makeAbsolute($path);
     if (is_file($path . $fileName) and is_readable($path . $fileName)) {
         $setup = t3lib_div::getUrl($path . $fileName);
         return $setup;
     }
     if (!$walkUp or $path == $basePath) {
         return false;
     }
     if (tx_dam::path_makeRelative($path) == '') {
         return false;
     }
     if (!($path = dirname($path))) {
         return false;
     }
     return tx_dam::tools_findFileInPath($fileName, $path, $walkUp, $basePath);
 }
 /**
  * Fetches the nearest indexing setup in filesystem.
  *
  * @param 	string 		$path Path to search for indexing setup
  * @param 	boolean 	$walkUp If set it will be searched for indexing setup in folders above the given
  * @param 	string 		$basePath This absolute path is the limit for searching with $walkUp
  * @return	string 		Setup file content
  */
 function findSetupInPath($path, $walkUp = true, $basePath = '')
 {
     $fileName = '.indexing.setup.xml';
     $path = tx_dam::path_makeAbsolute($path);
     $filepath = tx_dam::tools_findFileInPath($fileName, $path, $walkUp, $basePath);
     if ($this->writeDevLog) {
         t3lib_div::devLog('findSetupInPath(): ' . ($filepath ? 'true' : 'false'), 'tx_dam_indexing', 0, $filepath);
     }
     return $filepath;
 }