    indexing
    	description: "Directories, in the Unix sense, with creation and exploration features"
    	legal: "See notice at end of class."
    	status: "See notice at end of class."
    	date: "$Date: 2006-01-22 18:25:44 -0800 (Sun, 22 Jan 2006) $"
    	revision: "$Revision: 56675 $"

    class interface
    	DIRECTORY

    create
    	make (dn: STRING_8)
    			-- Create directory object for the directory
    			-- of name `dn'.
    		require
    			string_exists: dn /= Void

    	make_open_read (dn: STRING_8)
    			-- Create directory object for the directory
    			-- of name `dn' and open it for reading.
    		require
    			string_exists: dn /= Void

    feature -- Initialization

    	create_dir
    			-- Create a physical directory.
    		require
    			physical_not_exists: not exists

    	make (dn: STRING_8)
    			-- Create directory object for the directory
    			-- of name `dn'.
    		require
    			string_exists: dn /= Void

    	make_open_read (dn: STRING_8)
    			-- Create directory object for the directory
    			-- of name `dn' and open it for reading.
    		require
    			string_exists: dn /= Void

    feature -- Access

    	change_name (new_name: STRING_8)
    			-- Change file name to `new_name'
    		require
    			new_name_not_void: new_name /= Void
    			file_exists: exists
    		ensure
    			name_changed: name.is_equal (new_name)

    	close
    			-- Close directory.
    		require
    			is_open: not is_closed

    	has_entry (entry_name: STRING_8): BOOLEAN
    			-- Has directory the entry `entry_name'?
    			-- The use of `dir_temp' is required not
    			-- to change the position in the current
    			-- directory entries list.
    		require
    			string_exists: entry_name /= Void

    	name: STRING_8
    			-- Directory name

    	open_read
    			-- Open directory name for reading.

    	readentry
    			-- Read next directory entry
    			-- make result available in lastentry.
    			-- Make result void if all entries have been read.
    		require
    			is_opened: not is_closed

    	start
    			-- Go to first entry of directory.
    		require
    			is_opened: not is_closed

    feature -- Measurement

    	count: INTEGER_32
    			-- Number of entries in directory.
    		require
    			directory_exists: exists

    feature -- Status report

    	exists: BOOLEAN
    			-- Does the directory exist?

    	is_closed: BOOLEAN
    			-- Is current directory closed?

    	is_empty: BOOLEAN
    			-- Is directory empty?
    		require
    			directory_exists: exists

    	is_executable: BOOLEAN
    			-- Is the directory executable?
    		require
    			directory_exists: exists

    	is_readable: BOOLEAN
    			-- Is the directory readable?
    		require
    			directory_exists: exists

    	is_writable: BOOLEAN
    			-- Is the directory writable?
    		require
    			directory_exists: exists

    	lastentry: STRING_8
    			-- Last entry read by readentry

    feature -- Removal

    	delete
    			-- Delete directory if empty
    		require
    			directory_exists: exists
    			empty_directory: is_empty

    	delete_content
    			-- Delete all files located in current directory and its
    			-- subdirectories.
    		require
    			directory_exists: exists

    	delete_content_with_action (action: PROCEDURE [ANY, TUPLE]; is_cancel_requested: FUNCTION [ANY, TUPLE, BOOLEAN]; file_number: INTEGER_32)
    			-- Delete all files located in current directory and its
    			-- subdirectories.
    			--
    			-- `action' is called each time `file_number' files has
    			-- been deleted and before the function exits.
    			-- `action' may be set to Void if you don't need it.
    			--
    			-- Same for `is_cancel_requested'.
    			-- Make it return `True' to cancel the operation.
    			-- `is_cancel_requested' may be set to Void if you don't need it.
    		require
    			directory_exists: exists
    			valid_file_number: file_number > 0

    	dispose
    			-- Ensure this medium is closed when garbage collected.

    	recursive_delete
    			-- Delete directory, its files and its subdirectories.
    		require
    			directory_exists: exists

    	recursive_delete_with_action (action: PROCEDURE [ANY, TUPLE]; is_cancel_requested: FUNCTION [ANY, TUPLE, BOOLEAN]; file_number: INTEGER_32)
    			-- Delete directory, its files and its subdirectories.
    			--
    			-- `action' is called each time `file_number' files has
    			-- been deleted and before the function exits.
    		require
    			directory_exists: exists

    feature -- Conversion

    	linear_representation: ARRAYED_LIST [STRING_8]
    			-- The entries, in sequential format.

    invariant
    		-- from ANY
    	reflexive_equality: standard_is_equal (Current)
    	reflexive_conformance: conforms_to (Current)

    indexing
    	library: "EiffelBase: Library of reusable components for Eiffel."
    	copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
    	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
    	source: "[
    		Eiffel Software
    		356 Storke Road, Goleta, CA 93117 USA
    		Telephone 805-685-1006, Fax 805-685-6869
    		Website http://www.eiffel.com
    		Customer support http://support.eiffel.com
    	]"

    end -- class DIRECTORY