Open alexanderdean opened 10 years ago
Here's an impl:
# Check if a file exists in a given directory
Contract String, String => Bool
def file_exists?(s3, directory, file)
loc = Sluice::Storage::S3::Location.new(directory)
dir = s3.directories.get(loc.bucket, prefix: loc.dir_as_path)
(not dir.files.head(loc.dir_as_path + file).nil?)
end
There's no exists? currently, and is_file? and is_folder? don't check for existence first.