function locateSourceTemplate($file_name) { if (!lmbFs::isPathAbsolute($file_name)) { return $this->toolkit->tryFindFileByAlias($file_name, $this->scan_dirs, 'macro'); } elseif (file_exists($file_name)) { return $file_name; } }
function locate($alias, $params = array()) { if (false !== strpos($alias, "")) { return false; } if (lmbFs::isPathAbsolute($alias)) { if (file_exists($alias)) { return $alias; } else { $this->_handleNotResolvedAlias($alias); } } $paths = $this->locations->getLocations($params); foreach ($paths as $path) { if (file_exists($path . '/' . $alias)) { return $path . '/' . $alias; } } $this->_handleNotResolvedAlias($alias); }
function testIsPathAbsolute() { $this->assertTrue(lmbFs::isPathAbsolute('c:/var/wow', lmbFs::DOS)); $this->assertTrue(lmbFs::isPathAbsolute('/var/wow', lmbFs::UNIX)); $this->assertTrue(lmbFs::isPathAbsolute('/var/wow', lmbFs::DOS)); $this->assertFalse(lmbFs::isPathAbsolute('c:/var/wow', lmbFs::UNIX)); $this->assertFalse(lmbFs::isPathAbsolute('var/wow')); }