ensureExists

@param string $dir

@return void
421
private function ensureExists($dir)
    {
        if (!is_dir($dir)) {
            mkdir($dir, 0755, true);
        }

        return $this->validatePath($dir);
    }
118744
public function setCacheDir($dir)
    {
        if (GenericValidator::validateDirName($dir)) {
            $this->cacheDir = $dir;
            FileSystemHelper::setUpDir($dir);
            return true;
        }
        return false;
    }
407234
public function rm($dir)
    {
        $parseDir = $this->parseLastDirectory($dir);
        if (! ssh2_sftp_rmdir($this->getSFtp(), $parseDir)) {
            throw new DirectoryException('Directory not deleted');
        }
        return true;
    }
897433
function ensureDir(dir) {
  return new Promise((resolve, reject) => {
    try {
      FS.ensureDirSync(dir);
      resolve(dir);
    } catch (err) {
      reject(err);
    }
  });
}
1005141
private function checkDir() : void
    {
        $dir = dirname($this->path);
        if (!is_dir($dir)) {
            if (file_exists($dir)) {
                throw new \RuntimeException($dir . ' exists and is not a directory.');
            }
            if (!@mkdir($dir, 0755, true)) {
                throw new \RuntimeException($dir . ' does not exist and could not be created.');
            }
        }
    }
573988
def ensure_dir_exists(verify_dir):
    """"""
    if not os.path.exists(verify_dir):
        # Doesn't exist create dir
        os.makedirs(verify_dir)
    else:
        # Exists
        if not os.path.isdir(verify_dir):
            # Not a dir, raise an exception
            raise ValueError("{} is not a directory".format(verify_dir))
483157
def ensure_dir_exists(directory):
    ""
    if directory.startswith('gs://'):
        return
    if not os.path.exists(directory):
        dbg("Making dir {}".format(directory))
    os.makedirs(directory, exist_ok=True)
527600
protected static function isHaveMigrations($dir)
    {
        if (!is_dir($dir)) {
            return false;
        }

        return (bool) Finder::create()
            ->in($dir)
            ->files()
            ->name('/Version\d{14}.*\.php/')
            ->count()
        ;
    }
717020
public function isIn($dir) {
		if(!$this->formatPath($dir))
			return false;
		return strpos($this->formatPath($this->src()), $this->formatPath($dir)) === 0;
	}
574619
private function ensureDirectoryIsSafe($directory)
    {
        if (
            $directory === '..'
            || strpos($directory, '../') !== false
            || strpos($directory, '/..') !== false
        ) {
            throw new \InvalidArgumentException("File path must not contain ..");
        }
    }
346630
public static function ForceRemoveDirectories($dir)
	{
		if($objs = glob($dir."/*")){
			foreach($objs as $obj) {
				is_dir($obj)? self::ForceRemoveDirectories($obj) : self::DeleteFileString($obj);
			}
		}
		self::DeleteDirectory($dir);
	}
364616
def ensure_path_exists(dir_path):
    
    if not os.path.exists(dir_path):
        os.makedirs(dir_path)
        return True
    return False
272660
function ensureExistsAndClean (dir) {
  if (!fs.existsSync(dir)) {
    fs.mkdirSync(dir)
  } else {
    cleanDir(dir)
  }
}
1157046
protected function isDir($dir)
    {
        try {
            $this->doChangeDir($dir);
            $this->doCdUp();

            return true;
        } catch (\Exception $ex) {
            return false;
        }

        return false;
    }
477261
public function createDir($dir)
    {
        $oldMask = umask(0);
        @mkdir($dir, self::PERMISSION, true);
        umask($oldMask);
    }
355259
public function mkdir($dir) {
		$this->connectIfNeeded();
		$this->handle->mkdir($dir);
		$this->onFolderCreated(new Event(['sender' => $this, 'data' => $dir]));
	}
1125075
final public static function isDirEmpty($dir)
    {
        if (!is_readable($dir)) {
            return (null);
        }
        $handle = opendir($dir);
        while (false !== ($entry = readdir($handle))) {
            if ($entry != "." && $entry != "..") {
                return (false);
            }
        }
        return (true);
    }