public function getFile($path, $throwException = true)
    {
        if ($path instanceof FileInterface) {
            return $path;
        }

        if (!$this->filesystem instanceof AggregateFilesystemInterface || $this->containsMountPoint($path)) {
            $file = $this->filesystem->getFile($path);
            if ($file->exists()) {
                return $file;
            }
            if ($throwException) {
                throw new FileNotFoundException($path);
            }

            return null;
        }

        // Trim "files/" from front of path for BC.
        if (strpos($path, 'files/') === 0) {
            $path = substr($path, 6);
        }

        foreach ($this->filesystemsToCheck as $mountPoint) {
            if (!$this->filesystem->hasFilesystem($mountPoint)) {
                continue;
            }

            $file = $this->filesystem->getFile("$mountPoint://$path");
            if ($file->exists()) {
                return $file;
            }
        }

        if ($throwException) {
            throw new FileNotFoundException($path);
        }

        return null;
    }