Method: Proj::FileApiImpl#open

Defined in:
lib/proj/file_api.rb

#open(path, access_mode) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/proj/file_api.rb', line 111

def open(path, access_mode)
  case access_mode
  when :PROJ_OPEN_ACCESS_READ_ONLY
    if File.exist?(path)
      @file = File.open(path, :mode => 'rb')
    else
      nil # False
    end
  when :PROJ_OPEN_ACCESS_READ_UPDATE
    if File.exist?(path)
      @file = File.open(path, :mode => 'r+b')
    else
      nil # False
    end
  when :PROJ_OPEN_ACCESS_CREATE
    @file = File.open(path, :mode => 'wb')
  end
end