本文整理汇总了PHP中FileUtil::normalizeSlashes方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::normalizeSlashes方法的具体用法?PHP FileUtil::normalizeSlashes怎么用?PHP FileUtil::normalizeSlashes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtil
的用法示例。
在下文中一共展示了FileUtil::normalizeSlashes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAbsolutePath
static function isAbsolutePath($path)
{
// This looks complex, but its really fairly simple.
//
// We're detecting existing absolute paths in the include
// by converting it to absolute, normalizing the slashes,
// and comparing the results.
//
// If we get an absolute path we just don't prepend the
// project relative path part.
//
$orgPath = FileUtil::normalizeSlashes($path);
$absPath = FileUtil::normalizeSlashes(realpath($path));
return strcasecmp($orgPath, $absPath) == 0;
}
示例2: generateFileList
function generateFileList(&$projectFiles, $outputName, &$output)
{
$projName = $this->name;
$projectFiles[$projName] = array();
foreach ($this->dir_list as $dir) {
$dir = FileUtil::normalizeSlashes($dir);
// Build the path.
if (FileUtil::isAbsolutePath($dir)) {
$curPath = $dir;
} else {
$curPath = FileUtil::collapsePath($output->base_dir . $dir);
}
$pathWalk =& $projectFiles[$projName];
if (T3D_Generator::$absPath) {
if (stristr($curPath, getEngineSrcDir()) || stristr($curPath, getLibSrcDir())) {
$curPath = T3D_Generator::$absPath . "/" . str_replace("../", "", $curPath);
}
}
// Check if its a file or a directory.
// If its a file just add it directly and build a containng filter/folder structure,
// for it else if a dir add all files in it.
if (is_file($curPath)) {
// Get the file name
$curFile = basename($curPath);
$curPath = dirname($curPath);
//echo( "FILE: " . $curFile . " PATH: " . $curPath . "\n" );
}
if (is_dir($curPath)) {
//echo( "DIR: " . $curPath . "\n" );
// Get the array we'll be adding things to...
$pathParts = explode('/', FileUtil::collapsePath($dir));
foreach ($pathParts as $part) {
// Skip parts that are relative paths - only want meaningful directories.
if ($part == '..') {
continue;
}
if (!is_array($pathWalk[$part])) {
$pathWalk[$part] = array();
}
$pathWalk =& $pathWalk[$part];
}
// Open directory.
//echo( "SCANNING: " . $curPath . "\n");
$dirHdl = opendir($curPath);
if (!$dirHdl) {
echo "Path " . $curPath . " not found, giving up.\n";
return false;
}
// Iterate over all the files in the path if not a single file spec.
if (!$curFile) {
while ($curFile = readdir($dirHdl)) {
// Skip out if it's an uninteresting dir...
if ($curFile == '.' || $curFile == '..' || $curFile == '.svn' || $curFile == 'CVS') {
continue;
}
$newEntry = $this->createFileEntry($output, $curPath, $curFile);
if ($newEntry) {
$pathWalk[] = $newEntry;
}
}
} else {
$newEntry = $this->createFileEntry($output, $curPath, $curFile);
if ($newEntry) {
$pathWalk = $newEntry;
}
$curFile = '';
}
// Clean up after ourselves!
closedir($dirHdl);
}
}
FileUtil::trimFileList($projectFiles);
// Uncomment me to see the structure the file lister is returning.
//print_r($projectFiles);
return true;
}