Permalink
Browse files

Check to see if local file exists before opening

  • Loading branch information...
1 parent 999d11e commit f0f7e86cfa265eac16bf3474b25558984c785078 @palexander palexander committed Feb 27, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 spec/suite_helper.rb
View
4 spec/suite_helper.rb
@@ -25,7 +25,9 @@ def self.open_file(filename_or_url, options = {}, &block)
when /^#{REMOTE_PATH}/
begin
#puts "attempt to open #{filename_or_url} locally"
- if response = ::File.open(filename_or_url.to_s.sub(REMOTE_PATH, LOCAL_PATH))
+ local_filename = filename_or_url.to_s.sub(REMOTE_PATH, LOCAL_PATH)
+ if ::File.exist?(local_filename)
+ response = ::File.open(local_filename)
#puts "use #{filename_or_url} locally"
case filename_or_url.to_s
when /\.jsonld$/

0 comments on commit f0f7e86

Please sign in to comment.