require "cgi"

class Environment
  def initialize
     @cgi=CGI.new("html4")
     print @cgi.header("type"=>"text/html") # hack, hack :-(

     path = []
     @cgiPath = @cgi.path_info
     if @cgi.path_info
       path = @cgi.path_info.split(/\//) 
       path.shift
     end

     path = path[0]
     if path == nil 
        @path = "" 
     else 
        @path = path
     end
  end

  def getCurrentRelPath
    if @cgiPath == nil
       "/"
    else
       @cgiPath + "/"
    end
  end

  def getCurrentFilePath
    Config::ROOT_DATA_DIR + getCurrentRelPath()
  end

end
