示例#1
0
 /**
  * @return org\jecat\framework\fs\File
  */
 public function findCompiled($sSourceFile, $sNamespace, $bAutoCreate = false)
 {
     $sPath = $this->compiledFolderPath() . '/' . $this->compileStrategySignture() . '/' . Locale::singleton()->localeName() . '/' . $sNamespace . '/' . $sSourceFile . '.php';
     $aFile = new File($sPath);
     if ($bAutoCreate and !$aFile->exists()) {
         $aFile->create();
     }
     return $aFile;
 }
示例#2
0
 public function createCompiledFile(File $aCompiledFile)
 {
     $aCompiledsDir = $aCompiledFile->directory();
     if (!$aCompiledsDir->exists()) {
         if (!$aCompiledsDir->create()) {
             throw new Exception("无法创建编译文件目录:%s", $aCompiledsDir->path());
         }
     }
     if (!$aCompiledFile->exists()) {
         $aCompiledFile->create();
     }
 }
示例#3
0
 public function createChildFile($sPath, $nFlag = File::CREATE_DEFAULT)
 {
     if (!($nFlag & FSO::CLEAN_PATH)) {
         $sPath = $this->path() . '/' . $sPath;
         // FSO::tidyPath($sPath,true) ;
     }
     if (is_dir($sPath)) {
         throw new Exception('试图创建File,但由于存在同名folder无法创建: %s', $sPath);
     } else {
         $aFile = new File($sPath, self::CLEAN_PATH);
         // 如果文件不存在,且没有要求 self::CREATE_ONLY_OBJECT ,则创建之
         if (!($nFlag & self::CREATE_ONLY_OBJECT) and !$aFile->exists()) {
             if (!$aFile->create($nFlag)) {
                 throw new Exception('无法创建文件:%s', $sPath);
             }
         }
     }
     return $aFile;
 }