/*
Determine if the file managed by this LogFileHandle instance currently exists
on disk.

@return boolean true if the file currently exists.
518832
protected boolean fileExists()
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "fileExists", this);

        boolean fileAlreadyExists = true;

        File file = new File(_logDirectory, _fileName);
        fileAlreadyExists = (file.exists() && (file.length() > 0));

        if (tc.isEntryEnabled())
            Tr.exit(tc, "fileExists", new Boolean(fileAlreadyExists));
        return fileAlreadyExists;
    }
603849
public function exists(?string $name = null): bool
    {
        if ($name != null) {
            $fileInfo = new MFileInfo($name);
            return $fileInfo->exists();
        }

        return $this->fileInfo->exists();
    }
684260
protected function isExpired()
    {
        if (! $this->filesystem->exists($this->cached)) {
            return true;
        }

        $lastModified = $this->filesystem->lastModified($this->file->getPath());

        return $lastModified >= $this->filesystem->lastModified($this->cached);
    }
116710
protected function ensure_path_exists() {
        global $CFG;
        if (!is_writable($this->path)) {
            if ($this->custompath && !$this->autocreate) {
                throw new coding_exception('File store path does not exist. It must exist and be writable by the web server.');
            }
            $createdcfg = false;
            if (!isset($CFG)) {
                // This can only happen during destruction of objects.
                // A cache is being used within a destructor, php is ending a request and $CFG has
                // already being cleaned up.
                // Rebuild $CFG with directory permissions just to complete this write.
                $CFG = $this->cfg;
                $createdcfg = true;
            }
            if (!make_writable_directory($this->path, false)) {
                throw new coding_exception('File store path does not exist and can not be created.');
            }
            if ($createdcfg) {
                // We re-created it so we'll clean it up.
                unset($CFG);
            }
        }
        return true;
    }
371613
public function check()
    {
        $this->isFound = file_exists($this->filename);
        $this->isReadable = is_readable($this->filename);

        $result = $this->isFound && $this->isReadable;

        return $result;
    }
866291
protected boolean isAvailable() {
        // If in memory, it's available.
        if (fileItem.isInMemory()) {
            return true;
        }
        // Check actual existence of temporary file.
        if (fileItem instanceof DiskFileItem) {
            return ((DiskFileItem)fileItem).getStoreLocation().exists();
        }
        // Check whether current file size is different than original one.
        return (fileItem.getSize() == size);
    }
614730
public function exists()
	{
		$exists	= file_exists( $this->fileName );
		$isFile	= is_file( $this->fileName );
		return $exists && $isFile;
	}
1273351
public boolean deleteExisting(final File file) {
    if (!file.exists()) {
      return true;
    }
    boolean deleted = false;
    if (file.canWrite()) {
      deleted = file.delete();
    } else {
      LogLog.debug(file + " is not writeable for delete (retrying)");
    }
    if (!deleted) {
      if (!file.exists()) {
        deleted = true;
      } else {
        file.delete();
        deleted = (!file.exists());
      }
    }
    return deleted;
  }
428474
private function isLocalFile()
    {
        try {
            if (file_exists(storage_path('app/'.$this->location))) {
                return true;
            }
        } catch (Exception $e) {
            Log::debug('Could not find the image');

            return false;
        }

        return false;
    }
1081951
function exists()
    {
        $path = $this->filePath;
        $rc = isset( $this->metaData['mtime'] );
        eZDebugSetting::writeDebug( 'kernel-clustering', "fs::exists( '$path' ): " . ( $rc ? 'true' :'false' ), __METHOD__ );
        return $rc;
    }
109599
public boolean exists(final Path f) throws IOException {
		try {
			return (getFileStatus(f) != null);
		} catch (FileNotFoundException e) {
			return false;
		}
	}
605409
def has(self):
        """"""
        self._done = os.path.exists(self._cache_file)
        return self._done or self._out is not None
433502
public function isFile(): bool
    {
        if ($this->caching == false) {
            return is_file($this->getAbsoluteFilePath());
        }

        if ($this->isFile == null) {
            $this->isFile = is_file($this->getAbsoluteFilePath());
        }

        return $this->isFile;
    }
103919
public function file_exists($contextid, $component, $filearea, $itemid, $filepath, $filename) {
        $filepath = clean_param($filepath, PARAM_PATH);
        $filename = clean_param($filename, PARAM_FILE);

        if ($filename === '') {
            $filename = '.';
        }

        $pathnamehash = $this->get_pathname_hash($contextid, $component, $filearea, $itemid, $filepath, $filename);
        return $this->file_exists_by_hash($pathnamehash);
    }
1224941
public function fileExists($filename)
    {
        return isset($this->_fileHandlers[$filename]) ||
               file_exists($this->_dirPath . '/' . $filename);
    }
925928
public function isValid() {
        // TODO: stat-Cache bei wiederholten Aufrufen loeschen, siehe clearstatcache()

        if (file_exists($this->fileName)) {
            if ($this->lastModified !== filemtime($this->fileName))
                return false;
        }
        elseif ($this->lastModified !== null) {
            return false;
        }

        return true;
    }
186930
def exists(self, filename):
        """"""
        client = boto3.client("s3")
        bucket, path = self.bucket_and_path(filename)
        r = client.list_objects(Bucket=bucket, Prefix=path, Delimiter="/")
        if r.get("Contents") or r.get("CommonPrefixes"):
            return True
        return False