Changeset 16675


Ignore:
Timestamp:
2007/11/04 20:06:07 (16 years ago)
Author:
naka
Message:

再帰的にディレクトリを生成する関数を追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/util/SC_Utils.php

    r16582 r16675  
    13851385        } 
    13861386    } 
    1387  
     1387     
     1388    // ディレクトリを再帰的に生成する 
     1389    function sfMakeDir($path) { 
     1390        static $count = 0; 
     1391        $count++;  // 無限ループ回避 
     1392        $dir = dirname($path); 
     1393        if(ereg("^[/]$", $dir) || ereg("^[A-Z]:[\\]$", $dir) || $count > 256) { 
     1394            // ルートディレクトリで終了 
     1395            return; 
     1396        } else { 
     1397            if(is_writable(dirname($dir))) { 
     1398                if(!file_exists($dir)) { 
     1399                    mkdir($dir); 
     1400                    GC_Utils::gfPrintLog("mkdir $dir"); 
     1401                } 
     1402            } else { 
     1403                SC_Utils::sfMakeDir($dir); 
     1404                if(is_writable(dirname($dir))) { 
     1405                    if(!file_exists($dir)) { 
     1406                        mkdir($dir); 
     1407                        GC_Utils::gfPrintLog("mkdir $dir"); 
     1408                    } 
     1409                }         
     1410           } 
     1411        } 
     1412        return; 
     1413    } 
     1414         
    13881415    // ディレクトリ以下のファイルを再帰的にコピー 
    13891416    function sfCopyDir($src, $des, $mess, $override = false){ 
Note: See TracChangeset for help on using the changeset viewer.