当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUtil::normalizeSlashes方法代码示例

本文整理汇总了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;
 }
开发者ID:mray,项目名称:terminal-overload,代码行数:15,代码来源:FileUtil.php

示例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;
 }
开发者ID:tainer32,项目名称:Torque3D,代码行数:76,代码来源:Project.php


注:本文中的FileUtil::normalizeSlashes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。