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


PHP FileUtil::prepareOutputDir方法代码示例

本文整理汇总了PHP中FileUtil::prepareOutputDir方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::prepareOutputDir方法的具体用法?PHP FileUtil::prepareOutputDir怎么用?PHP FileUtil::prepareOutputDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileUtil的用法示例。


在下文中一共展示了FileUtil::prepareOutputDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 public function generate($tpl, $platform, $root_dir)
 {
     // Project container for templates
     $projects = array();
     $refs = array();
     // make sure that startup project is the first in the solution
     if (getGameProjectName()) {
         array_push($refs, getGameProjectName());
     }
     foreach ($this->project_refs as $pname) {
         if (getGameProjectName() && $pname == getGameProjectName()) {
             continue;
         }
         array_push($refs, $pname);
     }
     // Look up each project ref and add its info to the list
     foreach ($refs as $pname) {
         $project = Generator::lookupProjectByName($pname);
         if (isset($project)) {
             echo "      - project ref: " . $pname . " = " . $project->guid . "\n";
             array_push($projects, $project);
             // Let the project update any dependencies
             $project->validateDependencies();
         } else {
             trigger_error("Solution::generate() - project ref not found: " . $pname . "\n", E_USER_ERROR);
         }
     }
     // No use going forward if there were no projects for this solution is there?
     // (Would we ever want to generate an empty solution at all?)
     if (count($projects) == 0) {
         echo "Solution::generate() - no project refs found for solution: " . $this->name . "\n";
         continue;
     }
     //
     //sort( $projects );
     // Set smarty params that dont change during loop once here
     $tpl->assign_by_ref("solution_guid", $this->guid);
     $tpl->assign_by_ref("projects", $projects);
     $tpl->assign_by_ref("projectExtRefs", $this->project_extRefs);
     // Generate a solution file for all outputs for this solution
     foreach ($this->outputs as $output) {
         // Supported platform?
         if (!$output->supportsPlatform($platform)) {
             //echo( "      # Skipping output: '$outputName'.\n" );
             continue;
         }
         // Reset to base dir
         chdir($root_dir);
         // Then offset
         if (!FileUtil::prepareOutputDir($output->output_dir) || !$output->template_sln) {
             continue;
         }
         $outfile = $this->name . $output->solution_ext;
         echo "   - Writing solution file: " . $output->output_dir . "/" . $outfile;
         // Project filenames are <projectname>.<outputext> where ext is set per output.
         // The template builds each project output using the project name and this ext.
         $tpl->assign_by_ref("project_ext", $output->output_ext);
         if ($f = fopen($outfile, 'w')) {
             fputs($f, $tpl->fetch($output->template_sln));
             fclose($f);
             echo " - success " . "\n";
         } else {
             trigger_error("\nCould not write output file: " . $outfile, E_USER_ERROR);
         }
     }
 }
开发者ID:RasterCode,项目名称:Torque3D,代码行数:66,代码来源:Solution.php

示例2: generate

 public function generate($tpl, $platform, $base_dir)
 {
     // Alright, for each project scan and generate the file list.
     $projectFiles = array();
     $rootPhpBuildDir = getcwd();
     // Iterate over this project's outputs.
     foreach ($this->outputs as $outputName => $output) {
         $saved_includes = $this->includes;
         $saved_lib_dirs = $this->lib_dirs;
         //print_r( $output );
         // Supported platform?
         if (!$output->supportsPlatform($platform)) {
             //echo( "      # Skipping output: '$outputName'.\n" );
             continue;
         }
         // Get to the right working directory (first go back to root, then to relative)
         chdir($base_dir);
         //echo( "      - Changing CWD to " . $output->output_dir . "\n" );
         // echo("        (From: " . getcwd() . ")\n");
         if (!FileUtil::prepareOutputDir($output->output_dir)) {
             continue;
         }
         //echo( "      - Scanning directory for output  '.$outputName.'...\n" );
         if (!$this->generateFileList($projectFiles, $outputName, $output)) {
             echo "File list generation failed. Giving up on this project.\n";
             continue;
         }
         // Do any special work on the include/lib directories that we need
         $this->conditionDirectories($output, $projectFiles[$this->name]);
         $this->projectFileExt = $output->output_ext;
         if ($this->isCSProject()) {
             $this->projectFileExt = ".csproj";
         }
         // always csproj C# project under VS/MonoDevelop
         $outfile = $output->project_dir . $this->name . $this->projectFileExt;
         echo "      o Writing project file " . $outfile . "\n";
         $this->setTemplateParams($tpl, $output, $projectFiles[$this->name]);
         // To put a bandaid on the tools/player output dir problem
         // CodeReview: This should be in the template. -- BJG, 3/13/2007
         // Moved into templates -- neo
         // Write file
         $outdir = dirname($outfile);
         if (!file_exists($outdir)) {
             mkdir_r($outdir, 0777);
         }
         if ($hdl = fopen($outfile, 'w')) {
             if ($this->isApp()) {
                 $template = $output->template_app;
             } else {
                 if ($this->isLib()) {
                     $template = $output->template_lib;
                 } else {
                     if ($this->isSharedLib()) {
                         $template = $output->template_shared_lib;
                     } else {
                         if ($this->isSharedApp()) {
                             $template = $output->template_shared_app;
                         } else {
                             if ($this->isActiveX()) {
                                 $template = $output->template_activex;
                             } else {
                                 if ($this->isSafari()) {
                                     $template = $output->template_activex;
                                 } else {
                                     if ($this->isCSProject()) {
                                         $template = $output->template_csproj;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             fputs($hdl, $tpl->fetch($template));
             fclose($hdl);
         } else {
             trigger_error("Could not write output file: " . $output->outputFile, E_USER_ERROR);
         }
         if ($output->template_user) {
             $outfile = $output->project_dir . $this->name . $this->projectFileExt . '.' . getenv("COMPUTERNAME") . '.' . getenv("USERNAME") . '.user';
             if (!file_exists($outfile)) {
                 if ($hdl = fopen($outfile, 'w')) {
                     $template = $output->template_user;
                     fputs($hdl, $tpl->fetch($template));
                     fclose($hdl);
                 } else {
                     trigger_error("Could not write output file: " . $outfile, E_USER_ERROR);
                 }
             }
         }
         // Build the .filters file used by VS2010.
         if ($output->template_filter) {
             $filterData = new FilterData();
             array_walk($projectFiles[$this->name], array($filterData, 'callback'), '');
             $tpl->assign_by_ref('Folders', $filterData->folders);
             $tpl->assign_by_ref('SrcFiles', $filterData->srcFiles);
             $tpl->assign_by_ref('IncFiles', $filterData->incFiles);
             $tpl->assign_by_ref('OtherFiles', $filterData->otherFiles);
             $tpl->register_function('gen_uuid', 'gen_uuid');
             $outfile = $output->project_dir . $this->name . $this->projectFileExt . '.filters';
//.........这里部分代码省略.........
开发者ID:tainer32,项目名称:Torque3D,代码行数:101,代码来源:Project.php


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