Ensure the directory for the file exists
969757
def ensure_directory
      dir = File.dirname(full_filename)
      unless File.directory?(dir)
        FileUtils.mkdir_p(dir)
      end
    end
445159
def file_exists?(paths, file)
      paths.any? do |path|
        Find.find(path)
            .map { |path_file| Shellwords.escape(path_file) }
            .include?(file)
      end
    end
1064959
def _ensure_directory_exists(self, directory):
        """"""
        if not os.path.lexists(directory):
            os.makedirs(directory)
        return directory
630920
def ensure_dir(path):
    
    if not os.path.exists(path):
        # path does not exist, create the directory
        os.mkdir(path)
    else:
        # The path exists, check that it is not a file
        if os.path.isfile(path):
            raise Exception("Path %s already exists, and it is a file, not a directory" % path)
421205
def make_file_exist(self, filename=None):
        
        if filename is None:
            path_to_file = FilePath(self)
            path_to_file.make_file_exist()
            return path_to_file
        else:
            self.make_directory_exist()
            path_to_file = self.touch_file(filename)
            return FilePath(path_to_file)
2705
function existDir(getDir) {
        fs.exists(getDir, (exists) => {
            if (exists) {
                existDir(`${dir}/${getVersion()}`);
            } else {
                callBack(_baseVersion.join('.'));
            }
        });
    }
925848
def path_exists(self, path, follow_symlinks=True):
        ""
        return (
            self.file_exists(path, follow_symlinks)
            or self.symlink_exists(path, follow_symlinks)
            or self.directory_exists(path, follow_symlinks)
        )
1197293
def _assert_dirs_exist(self, setting_name):
        
        v = self._get_setting(setting_name)
        if (not os.path.isdir(os.path.split(v)[0])) or os.path.isdir(v):
            self.raise_config_error(
                setting_name,
                v,
                str,
                'a file path in an existing directory',
                is_none_allowed=False,
            )
872281
def _file_exists(path, filename):
  """"""
  return os.path.isfile(os.path.join(path, filename))
243806
def ensure_path_exists(dir_path):
    
    if not os.path.exists(dir_path):
        mkdir(dir_path)
        return True
    return False
317354
def ensure_dir_does_not_exist(*args):
    """"""
    path = os.path.join(*args)
    if os.path.isdir(path):
        shutil.rmtree(path)
382156
def ensure_workdir_exists(context):
    
    ensure_context_attribute_exists(context, "workdir", None)
    if not context.workdir:
        context.workdir = os.path.abspath(WORKDIR)
    pathutil.ensure_directory_exists(context.workdir)
447741
function exists(fileOrDir) {
  let stats;
  try {
    stats = statSync(fileOrDir);
    return stats.isFile() || stats.isDirectory();
  } catch (err) {
    return false;
  }
}
33568
def ensure_dir_exists(path):
    """"""

    import os

    f_dir = os.path.dirname(path)

    if not os.path.exists(f_dir):
        os.makedirs(f_dir)

    return f_dir
570607
def _make_sure_dir_exists(self):
        
        filename = self.model_config.checkpoint_dir()
        pathlib.Path(filename).mkdir(parents=True, exist_ok=True)
325520
def make_file_exist(self):
        """"""
        self.parent.make_directory_exist()
        self.parent.touch_file(self.name)
        return self
1338191
def ensure_dir(f):
    
    d = os.path.dirname(f)
    if not os.path.exists(d):
        os.makedirs(d)