Ensure that we have a directory to store the DB items.
429173
def ensure_dir_exists(dir)
      unless Dir.exist?(dir)
        begin
          Dir.mkdir(dir)
        rescue IOError => e
          PEROBS.log.fatal "Cannote create DB directory '#{dir}': #{e.message}"
        end
      end
    end
900314
public function setDirectory()
    {
        $pos = strrpos($this->dirPath, DIRECTORY_SEPARATOR);
        $this->directory = substr($this->dirPath, $pos + 1);
    }
533892
def ensure_data():
    '''
    
    '''
    if not os.path.exists(GARUDA_DIR):
        os.makedirs(GARUDA_DIR)
    Path(f'{GARUDA_DIR}/__init__.py').touch()
398148
def ensure_cache_folder(self):
    
    if os.path.exists(self.cache_folder) is False:
      os.makedirs(self.cache_folder)
1203195
function loadDir(dir, db, callback) {
    callback = callback || function() {};
    
    //Get the absolute dir path if a relative path was given
    if (dir.substr(0, 1) !== '/') {
        var parentPath = module.parent.filename.split('/');
        parentPath.pop();
        dir = parentPath.join('/') + '/' + dir;
    }
    
    //Load each file in directory
    fs.readdir(dir, function(err, files){
        if (err) return callback(err);
        
        var iterator = function(file, next){
            loadFile(dir + '/' + file, db, next);
        };
        async.forEach(files, iterator, callback);
    });
}
107083
def initialize_directories(self, root_dir):
        """"""
        if not root_dir:
            root_dir = os.path.expanduser('~')

        # Create config directory, if it doesn't exist
        self.config_dir = os.path.join(root_dir, '.config/pueue')
        if not os.path.exists(self.config_dir):
            os.makedirs(self.config_dir)
1301937
def _ensure_dir(self, template_name):
        """"""
        head = os.path.dirname(template_name)
        if head:
            file_dirpath = os.path.join(self.outpath, head)
            if not os.path.exists(file_dirpath):
                os.makedirs(file_dirpath)
1058573
def ensure_dir(directory: str) -> None:
    """"""
    if not os.path.isdir(directory):
        LOG.debug(f"Directory {directory} does not exist, creating it.")
        os.makedirs(directory)
1374520
def directory(self, query, **kwargs):
        """"""
        if isinstance(query, dict):
            query = str(query).replace("'", '"')

        return self.__call_api_get('directory', query=query, kwargs=kwargs)
446411
def _setup_user_dir(self):
        """"""
        user_dir = self._get_user_dir_path()

        rules_dir = user_dir.joinpath('rules')
        if not rules_dir.is_dir():
            rules_dir.mkdir(parents=True)
        self.user_dir = user_dir
303568
def ensure_dir(path):
    
    os.makedirs(os.path.abspath(os.path.dirname(path)), exist_ok=True)
5586
def create_database_folder(databasepath, database):
        
        logging.info('Setting up {} database'.format(database))
        # Define the path to store the database files
        databasepath = os.path.join(databasepath, database)
        # Create the path as required
        make_path(databasepath)
        return databasepath
618442
function buildFromDirectory(dirPath){
	var dbsetPath = path.join(dirPath,"dbsets");
	if(fileutil.isExist(dbsetPath)){
		defaultConfig['dbsets'] = dbsetPath;
	}

	var stubsPath = path.join(dirPath,"stubs");
	if(fileutil.isExist(stubsPath)){
		defaultConfig['stubs'] = stubsPath;
	}

	var dumpsPath = path.join(dirPath,"dumps");
	if(fileutil.isExist(dumpsPath)){
		defaultConfig['dumps'] = dumpsPath;
	}

	var mappingsPath = path.join(dirPath,"mappings");
	var files = fileutil.ls(mappingsPath);
	if(files.length > 0){
		defaultConfig['mappings']['requests'] = [];
		files.forEach(function(filename){
			defaultConfig['mappings']['requests'].push(path.join(mappingsPath , filename));
		});
	}

	var trustStorePath = path.join(dirPath,"truststore");
	if(fileutil.isExist(trustStorePath)){
		defaultConfig.server.key = path.join(trustStorePath , "server.key");
		defaultConfig.server.cert = path.join(trustStorePath , "server.crt");

		var cacertPath = path.join(trustStorePath,"ca");
		var cacerts = fileutil.ls(cacertPath);

		if(cacerts.length > 0){
			defaultConfig.server.ca = [];
			cacerts.forEach(function(filename){
				defaultConfig.server.ca.push(path.join(cacertPath , filename));
			});
		}
	}
}
906930
def initialize(dirs):
    
    if biolite and dirs.get("work"):
        base_dir = utils.safe_makedir(os.path.join(dirs["work"], "provenance"))
        p_db = os.path.join(base_dir, "biolite.db")
        biolite.config.resources["database"] = p_db
        biolite.database.connect()
862586
protected function setThemeDirectory()
    {
        $pos = strrpos($this->dirPath, DIRECTORY_SEPARATOR);

        $this->directory = substr($this->dirPath, $pos + 1);
    }
1245157
def ensure_dir(self, mode=0777):
        
        if not self.exists() or not self.isdir():
            os.makedirs(self, mode)
1366126
def build_directory():
    '''
    
    '''
    if os.path.exists('locale'):
        pass
    else:
        os.mkdir('locale')
    if os.path.exists(WHOOSH_DB_DIR):
        pass
    else:
        os.makedirs(WHOOSH_DB_DIR)