Checks that configured file system paths exist and are writable.
965923
protected function checkFileSystem() {
    $paths = [
      '%files' => 'Public files directory',
      '%private' => 'Private files directory',
      '%temp' => 'Temporary files directory',
    ];

    foreach ($paths as $key => $title) {
      if (empty($this->drushStatus['%paths'][$key])) {
        $this->logProblem(__FUNCTION__ . ":$key", "$title is not set.", 'error');

        continue;
      }

      $path = $this->drushStatus['%paths'][$key];
      if (substr($path, 0, 1) == '/') {
        $full_path = $path;
      }
      else {
        $full_path = $this->getConfigValue('docroot') . "/$path";
      }

      if (file_exists($full_path)) {
        if (!is_writable($full_path)) {
          $this->logProblem(__FUNCTION__ . ":$key", [
            "$title is not writable.",
            "",
            "Change the permissions on $full_path.",
            "Run `chmod 750 $full_path`.",
          ], 'error');
        }
      }
      else {
        $outcome = [
          "$title does not exist.",
          "",
          "Create $full_path.",
        ];

        if (in_array($key, ['%files', '%private'])) {
          $outcome[] = "Installing Drupal will create this directory for you.";
          $outcome[] = "Run `blt drupal:install` to install Drupal, or run `blt setup` to run the entire setup process.";
          $outcome[] = "Otherwise, run `mkdir -p $full_path`.";
          $outcome[] = "";
        }

        $this->logProblem(__FUNCTION__ . ":$key", $outcome, 'error');
      }

    }
  }
530943
def is_writable(self):
        
        if "/" in self.path:
            # example path: /log/ap/2013-01-17/00
            parts = self.path.split("/")
            # start with the full path and then up the tree until we can check
            length = len(parts)
            for part in range(length):
                path = "/".join(parts[0:length - part]) + "/"
                if self.fs.exists(path):
                    # if the path exists and we can write there, great!
                    if self._is_writable(path):
                        return True
                    # if it exists and we can't =( sad panda
                    else:
                        return False
            # We went through all parts of the path and we still couldn't find
            # one that exists.
            return False
183749
public function canWriteRoutes()
    {
        if (!is_null($this->bCanWriteRoutes)) {
            return $this->bCanWriteRoutes;
        }

        //  First, test if file exists, if it does is it writable?
        if (file_exists(static::ROUTES_DIR . static::ROUTES_FILE)) {

            if (is_writable(static::ROUTES_DIR . static::ROUTES_FILE)) {

                $this->bCanWriteRoutes = true;
                return true;

            } else {

                //  Attempt to chmod the file
                if (@chmod(static::ROUTES_DIR . static::ROUTES_FILE, FILE_WRITE_MODE)) {

                    $this->bCanWriteRoutes = true;
                    return true;

                } else {

                    $this->setError('The route config exists, but is not writable.');
                    $this->bCanWriteRoutes = false;
                    return false;
                }
            }

        } elseif (is_writable(static::ROUTES_DIR)) {

            $this->bCanWriteRoutes = true;
            return true;

        } else {

            //  Attempt to chmod the directory
            if (@chmod(static::ROUTES_DIR, DIR_WRITE_MODE)) {

                $this->bCanWriteRoutes = true;
                return true;

            } else {

                $this->setError('The route directory is not writable. <small>' . static::ROUTES_DIR . '</small>');
                $this->bCanWriteRoutes = false;
                return false;
            }
        }
    }
1028383
protected function isFilesystemWritable(/*# string */ $path)/*# : bool */
    {
        if ($this->getFilesystem()->isWritable()) {
            return true;
        } else {
            return $this->setError(
                Message::get(Message::STR_FS_NONWRITABLE, $path),
                Message::STR_FS_NONWRITABLE
            );
        }
    }
609328
def all_exist(filepaths):
  """"""
  for fname in filepaths:
    if not tf.gfile.Exists(fname):
      return False
  return True
769404
function isPathAccessible (filePath) {
  try {
    fs.accessSync(filePath)
    debug(`Utils: isPathAccessible(): ${filePath} exists`)
    return true
  } catch (err) {
    debug(`Utils: isPathAccessible(): ${filePath} does not exist`)
    return false
  }
}
682354
def check_output_file(self, path):
        
        if not gf.file_can_be_written(path):
            self.print_error(u"Unable to create file '%s'" % (path))
            self.print_error(u"Make sure the file path is written/escaped correctly and that you have write permission on it")
            return False
        return True
1340419
def is_file_writable(test_file):
    
    p = Path(test_file)

    if p.is_symlink():
        p = p.resolve(strict=False)

    # p.is_file() throws an exception in some cases
    if p.exists() and p.is_file():
        return os.access(
            os.fspath(p),
            os.W_OK,
            effective_ids=(os.access in os.supports_effective_ids),
        )
    else:
        try:
            fp = p.open('wb')
        except OSError:
            return False
        else:
            fp.close()
            with suppress(OSError):
                p.unlink()
        return True
991888
def is_readable(path):
    '''
    
    '''

    if os.access(path, os.F_OK) and os.access(path, os.R_OK):
        # The path exists and is readable
        return True

    # The path does not exist
    return False
872281
def _file_exists(path, filename):
  """"""
  return os.path.isfile(os.path.join(path, filename))
714189
def _check_file_existence(self, files):
        ''''''
        for f in files:
            if not os.path.isfile(f):
                logging.error("The file '%s' does not appear to exist, stopping" % f)
                exit(1)
373407
public static function writable($path)
    {
        $path = Normalize::diskFullPath($path);

        if (!self::exist($path)) {
            return false;
        }

        return (is_dir($path) && is_writable($path));
    }
649341
def exists(self, path):
        

        cmd = load_hadoop_cmd() + ['fs', '-stat', path]
        logger.debug('Running file existence check: %s', subprocess.list2cmdline(cmd))
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True, universal_newlines=True)
        stdout, stderr = p.communicate()
        if p.returncode == 0:
            return True
        else:
            not_found_pattern = "^.*No such file or directory$"
            not_found_re = re.compile(not_found_pattern)
            for line in stderr.split('\n'):
                if not_found_re.match(line):
                    return False
            raise hdfs_error.HDFSCliError(cmd, p.returncode, stdout, stderr)
421599
def exists(*paths):
    
    for path in paths:
        log(_("checking that {} exists...").format(path))
        if not os.path.exists(path):
            raise Failure(_("{} not found").format(path))
1302474
def is_valid_file(path):
    '''  '''
    return os.path.exists(path) and os.path.isfile(path)
281167
def files_exist(self, file_paths):
    
    results = {}

    def exist_thunk(paths, interface):
      results.update(interface.files_exist(paths))

    if len(self._threads):
      for block in scatter(file_paths, len(self._threads)):
        self.put(partial(exist_thunk, block))
    else:
      exist_thunk(file_paths, self._interface)

    desc = 'Existence Testing' if self.progress else None
    self.wait(desc)

    return results
492198
public function check(): bool
    {
        $path = \app()->storagePath();

        $this->description = Str::replace($this->description, \compact('path'));

        return $this->checkPathIsWritable($path);
    }