CREATE DIRECTORY
@return bool 是否创建成功
193036
public function create() {
        if ($this->exist()) {
            return true;
        }
        $args = explode('/', str_replace('\\', '/', $this->fullName));
        $directory = '';
        $result = true;
        foreach ($args as $item) {
            $directory .= $item . '/';
            if (!is_dir($directory) && !empty($directory)) {
                $result = mkdir($directory);
            }
        }
        return $result;
    }
1175420
protected function createDirectory($directory)
    {
        $isCreated = file_exists($directory) || is_dir($directory) || mkdir($directory, 0777, true);
        
        if (!$isCreated)
            throw new RuntimeException('Cannot create directory ":dir" for generated classed', ['dir' => $directory]);
        
        return $this;
    }
133256
public function createDirectory($directory)
    {
        $result = @ftp_mkdir($this->connection, $directory);
        
        if ($result === false) {
            throw new Exception('Unable to create directory');
        }

        return $this;
    }
258640
def _create(self):
        """"""

        self._raise_if_none()
        if not self._exists:
            mkdir_p(self.path)
            self._exists = True
1132171
def make_dir(cls, directory_name):
        """"""
        if not os.path.exists(directory_name):
            os.makedirs(directory_name)
511597
public function CreateProjectDirectory($dir) {
		$filepath = "{$this->ProjectRoot}/{$dir}";

		if(!file_exists($filepath)) @mkdir($filepath,0777,true);
		if(!file_exists($filepath)) throw new Exception("unable to create {$dir}");

		return $this;
	}
1353502
private function _buildDirectory()
    {
        // Vars
        $fields = array();
        $directory = array();
        $data_end = 0;

        foreach ($this->fields as $field) {
            // No empty fields allowed
            if (!$field->isEmpty()) {
                // Get data in raw format
                $str = $field->toRaw();
                $fields[] = $str;

                // Create directory entry
                $len = strlen($str);
                $direntry = sprintf("%03s%04d%05d", $field->getTag(), $len, $data_end);
                $directory[] = $direntry;
                $data_end += $len;
            }
        }

        /**
         * Rules from MARC::Record::USMARC
         */
        $base_address
            = File_MARC::LEADER_LEN +    // better be 24
                (count($directory) * File_MARC::DIRECTORY_ENTRY_LEN) +
                                // all the directory entries
                1;              // end-of-field marker


        $total
            = $base_address +  // stuff before first field
                $data_end +      // Length of the fields
                1;              // End-of-record marker


        return array($fields, $directory, $total, $base_address);
    }
1168058
public function save()
    {
        $dir = dirname($this->path);

        if (!is_dir($dir)) {
            $mask = @umask(0);
            $result = @mkdir($dir, $this->dirMode, true);
            @umask($mask);

            if (!$result) {
                throw new Exception("Unable to create the directory '$dir'.");
            }
        }

        if (@file_put_contents($this->path, $this->content) === false) {
            throw new Exception("Unable to write the file '{$this->path}'.");
        }

        $mask = @umask(0);
        @chmod($this->path, $this->mode);
        @umask($mask);

        return true;
    }
611877
protected function createConfigDirectory()
    {
        $this->displayMsgInCli(' >> Create config directory for this module ... ');
        
        $alreadyExist = file_exists($this->targetConfigPath);
        
        //If the directory already exist and if it's a reinstall
        if ($alreadyExist && $this->forceReinstall === true) {
            $this->displayMsgInCli('[Force Reinstall: Remove directory] ');
            
            $alreadyExist = false;
            if (!$this->removeRecursiveDirectory($this->targetConfigPath)) {
                $this->displayMsgNLInCli(
                    'Remove the module config directory have fail',
                    'red',
                    'bold'
                );
                
                throw new Exception(
                    'Reinstall fail. Remove module config directory error',
                    $this::ERR_REINSTALL_FAIL_REMOVE_CONFIG_DIR
                );
            }
        }
        
        //If the directory already exist, nothing to do
        if ($alreadyExist) {
            $this->displayMsgNLInCli('Already exist', 'yellow', 'bold');
            return;
        }
        
        //Create the directory
        if (!mkdir($this->targetConfigPath, 0755)) {
            $this->displayMsgNLInCli('Fail', 'red', 'bold');
            
            throw new Exception(
                'Error to create the config directory.',
                $this::ERR_FAIL_CREATE_CONFIG_DIR
            );
        }

        $this->displayMsgNLInCli('Done', 'green', 'bold');
    }
282546
public function create()
    {
        if (! $this->exists() && $this->canCreate()) {
            $this->adapter->mkdir($this->path, 0755, true);
        }
        return $this;
    }
1284191
protected function createServiceDirectory()
    {
        if( ! $this->files->isDirectory($this->getServiceDirectory())) {
            $this->files->makeDirectory($this->getServiceDirectory());
        }

        $this->createDirectory('service');
    }
176281
public static function createTempDir()
    {
        do {
			$folder = sys_get_temp_dir().DIRECTORY_SEPARATOR."tmp".mt_rand().DIRECTORY_SEPARATOR;
		} while (file_exists($folder));
		mkdir($folder);
		return $folder;
    }
978269
public static function create()
	{
		if ( file_exists( self::$authFile ) ) return false;
		if ( @touch( self::$authFile ) === false ) return false;

		self::$auth = array(
			'generated' => date('U'),
			'security'  => self::generateSecurityToken(),
			'anonymous' => array(),
			'users'     => array(),
		);

		self::save();

		return true;
	}
1232352
protected function prepareAndGetDirectory()
    {
        if (! $this->filesystem->isDirectory($this->directory)) {
            $this->filesystem->makeDirectory($this->directory, 0755, true);
        }

        return $this->directory;
    }
444249
public function makePath()
    {
        $path = base_path('src');

        if (!File::exists($path)) {
            File::makeDirectory($path, 0775, true);
        }
    }
248094
def create_directory(directory):
    
    try:
        os.makedirs(directory)
    except OSError, e:
        if e.errno == errno.EEXIST and os.path.isdir(directory):
            pass

    return directory
1312904
public function newDirectory()
    {
        $target_full_path = $this->getTargetFile()->getFilepath(true);
        $this->event(YouweFileManagerEvents::BEFORE_FILE_DIR_CREATED);
        $this->getDriver()->makeDir($target_full_path);
        $this->getCurrentFile()->updateFilepath($target_full_path);
        $this->event(YouweFileManagerEvents::AFTER_FILE_DIR_CREATED);
    }