# File lib/phusion_passenger.rb, line 64
        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  = {}
                        in_locations_section = false
                        File.open(filename, 'r') do |f|
                                while !f.eof?
                                        line = f.readline
                                        line.strip!
                                        next if line.empty?
                                        if line =~ /\A\[(.+)\]\Z/
                                                in_locations_section = $1 == 'locations'
                                        elsif in_locations_section && line =~ /=/
                                                key, value = line.split(/ *= */, 2)
                                                options[key.freeze] = value.freeze
                                        end
                                end
                        end
                        
                        @natively_packaged     = get_bool_option(filename, options, 'natively_packaged')
                        @bin_dir               = get_option(filename, options, 'bin').freeze
                        @agents_dir            = get_option(filename, options, 'agents').freeze
                        @lib_dir               = get_option(filename, options, 'libdir').freeze
                        @helper_scripts_dir    = get_option(filename, options, 'helper_scripts').freeze
                        @resources_dir         = get_option(filename, options, 'resources').freeze
                        @include_dir           = get_option(filename, options, 'includedir').freeze
                        @doc_dir               = get_option(filename, options, 'doc').freeze
                        @apache2_module_path   = get_option(filename, options, 'apache2_module').freeze
                        @ruby_extension_source_dir = get_option(filename, options, 'ruby_extension_source').freeze
                else
                        @source_root           = File.dirname(File.dirname(FILE_LOCATION))
                        @natively_packaged     = false
                        @bin_dir               = "#{@source_root}/bin".freeze
                        @agents_dir            = "#{@source_root}/agents".freeze
                        @lib_dir               = "#{@source_root}/libout".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
                        @apache2_module_path   = "#{@source_root}/libout/apache2/mod_passenger.so".freeze
                        @ruby_extension_source_dir = "#{@source_root}/ext/ruby"
                end
        end