# File lib/phusion_passenger.rb, line 77
        def self.locate_directories(source_root_or_location_configuration_file = nil)
                source_root_or_location_configuration_file ||= find_location_configuration_file
                root_or_file = @source_root = source_root_or_location_configuration_file
                
                if root_or_file && File.file?(root_or_file)
                        filename = root_or_file
                        options  = parse_ini_file(filename)
                        
                        @natively_packaged     = get_bool_option(filename, options, 'natively_packaged')
                        REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
                                instance_variable_set("@#{field}", get_option(filename, options, field.to_s).freeze)
                        end
                        OPTIONAL_LOCATIONS_INI_FIELDS.each do |field|
                                instance_variable_set("@#{field}", get_option(filename, options, field.to_s, false).freeze)
                        end
                else
                        @source_root           = File.dirname(File.dirname(FILE_LOCATION))
                        @natively_packaged     = false
                        @bin_dir               = "#{@source_root}/bin".freeze
                        @agents_dir            = "#{@source_root}/buildout/agents".freeze
                        @lib_dir               = "#{@source_root}/buildout".freeze
                        @helper_scripts_dir    = "#{@source_root}/helper-scripts".freeze
                        @resources_dir         = "#{@source_root}/resources".freeze
                        @include_dir           = "#{@source_root}/ext".freeze
                        @doc_dir               = "#{@source_root}/doc".freeze
                        @ruby_libdir           = File.dirname(FILE_LOCATION)
                        @apache2_module_path   = "#{@source_root}/buildout/apache2/mod_passenger.so".freeze
                        @ruby_extension_source_dir = "#{@source_root}/ext/ruby"
                        @nginx_module_source_dir   = "#{@source_root}/ext/nginx"
                        @download_cache_dir    = "#{@source_root}/download_cache"
                        REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
                                if instance_variable_get("@#{field}").nil?
                                        raise "BUG: @#{field} not set"
                                end
                        end
                end
        end