create path if it doesn't exist
172096
def safe_mkdir(path, uid=-1, gid=-1):
    
    try:
        os.mkdir(path)
    except OSError as e:
        if e.errno == errno.EEXIST:
            pass
        else:
            raise
    else:
        os.chown(path, uid, gid)
670495
def make_sure_path_exists(self, path):
        
        try:
            os.makedirs(path)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise
553623
def make_dirs_if_dont_exist(path):
    
    if path[-1] not in ['/']: path += '/'
    path = os.path.dirname(path)
    if path != '':
        try: os.makedirs(path)
        except OSError: pass
518273
def _create_path(self):
        """"""

        if self.driver == 'sqlite' and 'memory' not in self.dsn and self.dsn != 'sqlite://':

            dir_ = os.path.dirname(self.path)

            if dir_ and not os.path.exists(dir_):
                try:
                    # Multiple process may try to make, so it could already
                    # exist
                    os.makedirs(dir_)
                except Exception:
                    pass

                if not os.path.exists(dir_):
                    raise Exception("Couldn't create directory " + dir_)
382975
def ensure_path(filename):
    
    dirname = os.path.dirname(filename)
    if dirname and not os.path.exists(dirname):
        os.makedirs(dirname)
1233282
def exists(self, path):
        
        _complain_ifclosed(self.closed)
        return self.fs.exists(path)
629318
def path_exists?(path = @path)
      path = path.split(' ') if path.is_a?(String) && path.include?(' ')
      if path.is_a?(Array)
        path.each do |p|
          unless File.exist?(p)
            puts "#{p} does not exist"
            return false
          end
        end
      else
        path = path.gsub('/**', '').gsub('/*', '').gsub(/\/\.*/, '') if path.include?('*')
        if File.exist?(path)
          return true
        else
          puts "#{path} does not exist"
          return false
        end
      end
    end
218051
def create_path(self, path, **kwargs):
        """"""

        i = 0
        while i < len(path):
            i = path.find("/", i)

            if i < 0:
                return

            subpath = path[:i]

            if i > 0:
                try:
                    yield self.create(subpath, **kwargs)
                except NodeExistsException:
                    pass

            i += 1
884035
def existing_path(string):
    ''''''
    if not os.path.exists(string):
        msg = 'path {0!r} does not exist'.format(string)
        raise argparse.ArgumentTypeError(msg)
    return string
364616
def ensure_path_exists(dir_path):
    
    if not os.path.exists(dir_path):
        os.makedirs(dir_path)
        return True
    return False
1286899
def exists(path):
    """"""
    try:
        return path.expanduser().absolute().exists()
    except AttributeError:
        return os.path.exists(os.path.abspath(os.path.expanduser(str(path))))
783797
function PathNotFoundError(path, sympath){
  superError.call(
    this,
    'PathNotFoundError',
    util.format('Path was not found in the tree: %s', sympath)
  );

  this.arrayPath = path;
  this.sympath = sympath;
}
993911
def path_exists(self, dest, weight=None):
        
        try:
            return bool(self.shortest_path_length(dest, weight))
        except KeyError:
            return False
1195311
def exists(self, relpath):
    """"""
    if self.isignored(self._append_slash_if_dir_path(relpath)):
      return False
    return self._exists_raw(relpath)
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)
501663
def _ensure_exists(name, path=None):
    '''
    
    '''
    if not exists(name, path=path):
        raise CommandExecutionError(
            'Container \'{0}\' does not exist'.format(name)
        )
1353049
function _ensureExists(dir, callback) {
    dir = path.resolve(dir); // make full path
    
    path.exists(dir, function(exists) {
        if (!exists) {
            // ensure that the parent dir exists
            _ensureExists(path.dirname(dir), function(err) {
                if (err) {
                    callback(err);
                    return;
                }
                
                // make the dir
                log.log('Creating ' + dir);
                fs.mkdir(dir, function(err) {
                    if (err) {
                        callback(err);
                        return;
                    }
                    
                    callback(null);
                });
            });
        }
        else {
            callback(null);
        }
    });
}