TODO: What happens if the file does not exist?
971419
public static long getFreeSpace(final File pPath) {
        // NOTE: Allow null, to get space in current/system volume
        File path = pPath != null ? pPath : new File(".");

        Long space = getSpace16("getFreeSpace", path);
        if (space != null) {
            return space;
        }

        return FS.getFreeSpace(path);
    }
16886
function checkFileExists(filename, callback) {
  if (fs.exists !== undefined) {
    fs.exists(filename, callback);
  } else {
    fs.stat(filename, function (err) {
      callback(!err);
    });
  }
}
382894
function exists(file, src, opts) {
	var files = opts.path.map(function (dir) {
		return path.join(dir, file);
	});

	files = globby.sync(files);

	if (!files.length) {
		throw new Error(createError(file, src, opts.path));
	}

	return files[0];
}
350992
def file_exists?(file_path)
      if @site.respond_to?(:in_source_dir)
        File.exist? @site.in_source_dir(file_path)
      else
        File.exist? Bunto.sanitized_path(@site.source, file_path)
      end
    end
3249
private void checkForExistence(String fileName) throws IOException {
        File file = new File(fileName);
        if (!file.exists()) {
            throw new FileNotFoundException("File with name " + fileName + " does not exist.");
        }
        if (!file.isFile()) {
            throw new IOException("Provided string does not correspond to an actual file.");
        }

    }
929851
def _checkFileExists(self):
        
        if self._fileName and not os.path.exists(self._fileName):
            msg = "File not found: {}".format(self._fileName)
            logger.error(msg)
            self.setException(IOError(msg))
            return False
        else:
            return True
387292
def check_exists(filename, oappend=False):
    
    if op.exists(filename):
        if oappend:
            return oappend
        logging.error("`{0}` found, overwrite (Y/N)?".format(filename))
        overwrite = (raw_input() == 'Y')
    else:
        overwrite = True

    return overwrite
782392
function isAlreadyUploaded(file_mngr_url, filename, file_exists_cb, file_absent_cb) {
    var req = new XMLHttpRequest();
    req.open("GET", file_mngr_url + "/test/" + filename);
    req.onload = function(e) {
        var url = JSON.parse(req.response).url;
        if (url === undefined)
            file_absent_cb();
        else
            file_exists_cb(url);
    };
    req.send();
}
90613
@Override
	public boolean exists() {
		try {
			InputStream inputStream = this.assetManager.open(this.fileName);
			if (inputStream != null) {
				return true;
			} else {
				return false;
			}
		} catch (IOException e) {
			return false;
		}
	}
372861
def file_exists?(path)
      begin
        ret = self.quietly { ls(path) }
      rescue Rye::Err => ex
        ret = ex.rap
      end
      # "ls" returns a 0 exit code regardless of success in Linux
      # But on OSX exit code is 1. This is why we look at STDERR. 
      !(ret.exit_status > 0) || ret.stderr.empty?
    end
487494
def check_file_existence(path):
    

    pathvalidate.validate_file_path(path)

    if not os.path.lexists(path):
        raise FileNotFoundError(path)

    if os.path.isfile(path):
        logger.debug("file found: " + path)
        return FileType.FILE

    if os.path.isdir(path):
        logger.debug("directory found: " + path)
        return FileType.DIRECTORY

    if os.path.islink(path):
        logger.debug("link found: " + path)
        return FileType.LINK

    raise RuntimeError()
357460
def copy_file_if_missing(file, to_directory)
      unless File.exists? File.join(to_directory, File.basename(file))
        FileUtils.cp(file, to_directory)
      end
    end
492029
public boolean exists(String filename)
        throws IOException, ServerException {
        if (filename == null) {
            throw new IllegalArgumentException("Required argument missing");
        }
        try {
            Reply reply =
                controlChannel.exchange(new Command("RNFR", filename));
            if (Reply.isPositiveIntermediate(reply)) {
                controlChannel.execute(new Command("ABOR"));
                return true;
            } else {
                return false;
            }
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(
                                urce,
                                "Abort failed");
        }
    }
243446
function doesFileExist(filePath) {
    if (!fileExistsCache.hasOwnProperty(filePath)) {
        fileExistsCache[filePath] = fs.existsSync(filePath);
    }

    return fileExistsCache[filePath];
}
68112
public boolean exists() {
		// Try file existence: can we find the file in the file system?
		try {
			return getFile().exists();
		}
		catch (IOException ex) {
			// Fall back to stream existence: can we open the stream?
			try {
				InputStream is = getInputStream();
				is.close();
				return true;
			}
			catch (Throwable isEx) {
				return false;
			}
		}
	}
440337
function existsFile(file, permission) {
    return Promise.resolve(fsPromise.accessAsync(file, permission))
      .then(() => true)
      .catch(() => false);
}
147331
def file_exists(original_file):
    
    if original_file.startswith("s3://"):
        from filesystem import s3
        return s3.file_exists(original_file)
    else:
        if not os.path.exists(original_file):
            return False
        if not os.path.isfile(original_file):
            return False
    return True