Skip to content

Commit

Permalink
Add stubs for methods with file acces
Browse files Browse the repository at this point in the history
Trying to load a location from a file will fail because `File` is not
yet ported to windows.
  • Loading branch information
straight-shoota committed Jan 17, 2018
1 parent ae7e6b8 commit bbd4274
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/time/location/loader.cr
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class Time::Location

# :nodoc:
def self.load_from_dir_or_zip(name : String, source : String)
{% if flag?(:win32) %}
raise NotImplementedError.new("Time::Location.load_from_dir_or_zip")
{% else %}
if source.ends_with?(".zip")
open_file_cached(name, source) do |file|
read_zip_file(name, file) do |io|
Expand All @@ -35,6 +38,7 @@ class Time::Location
read_zoneinfo(name, file)
end
end
{% end %}
end

private def self.open_file_cached(name : String, path : String)
Expand All @@ -57,6 +61,9 @@ class Time::Location

# :nodoc:
def self.find_zoneinfo_file(name : String, sources : Enumerable(String))
{% if flag?(:win32) %}
raise NotImplementedError.new("Time::Location.find_zoneinfo_file")
{% else %}
sources.each do |source|
if source.ends_with?(".zip")
return source if File.exists?(source)
Expand All @@ -65,6 +72,7 @@ class Time::Location
return source if File.exists?(path)
end
end
{% end %}
end

# Parse "zoneinfo" time zone file.
Expand Down

0 comments on commit bbd4274

Please sign in to comment.