+
Point of view
All features
expanded class BASIC_DIRECTORY
Summary
Very low-level basic tools for file-system directory handling and file path manipulation. This class intended to be platform independent as much as possible. In order to remove from the client side the burden of file path computation, this class tries to compute automatically the system file notation using argument(s) of some of the very first call(s). As soon as the system notation has been properly detected, the result is internally memorized for all objects of type BASIC_DIRECTORY in a common private buffer. Besides the low-level nature of operations one can found in this class, all file path manipulations are done in a smart way (except when the system file path notation has not been detected automatically, which is quite uncommon). As an example, even if the directory separator is internally detected, this information is _intentionally_ kept private to avoid low-level manipulation from the client side. Finally, this class is expanded in order to avoid as much as possible memory allocations.
Also consider high level facade class DIRECTORY if you don't want to deal directly with low level directory streams.
Direct parents
Insert list: ANY
Known children
Insert list: XDG
Overview
Features
{}
State of Current basic directory stream:
{ANY}
Connect and disconnect:
{ANY}
  • connect_to (directory_path: ABSTRACT_STRING)
    Try to connect Current to some existing directory_path.
  • connect_with (some_path: ABSTRACT_STRING)
    Try to connect Current to some directory using some_path which may be either an existing directory path or some arbitrary file path name.
  • connect_to_current_working_directory
    Try to connect Current to the current working directory.
  • disconnect
    Do not forget to call this feature when you have finished with some previously opened directory stream.
Scanning:
{ANY}
File path handling tools:
{ANY}
Disk modification:
{ANY}
Miscellaneous:
{ANY}
{DIRECTORY_NOTATION_HANDLER}
{}
directory_stream: POINTER
writable attribute
{}
This pointer memorize the current directory stream being scanned (used to compute is_connected).
current_entry: POINTER
writable attribute
{}
When is_connected, memorize the current entry in the current directory_stream.
is_connected: BOOLEAN
effective function
{ANY}
Is Current connected to some directory stream ?
end_of_input: BOOLEAN
effective function
{ANY}
Is end of input reached ?
connect_to (directory_path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to connect Current to some existing directory_path.
connect_with (some_path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to connect Current to some directory using some_path which may be either an existing directory path or some arbitrary file path name.
connect_to_current_working_directory
effective procedure
{ANY}
Try to connect Current to the current working directory.
disconnect
effective procedure
{ANY}
Do not forget to call this feature when you have finished with some previously opened directory stream.
last_entry: STRING
once function
{ANY}
Unique global buffer (once object) to get the last information computed by many routines of this class: read_entry, connect_with connect_to_current_working_directory, compute_parent_directory_of, ...
read_entry
effective procedure
{ANY}
Read the next entry name and update last_entry and end_of_input accordingly.
compute_parent_directory_of (some_path: ABSTRACT_STRING)
effective procedure
{ANY}
Using some_path (which may be either a file path or a directory path) tries to compute in the last_entry buffer the parent directory of some_path.
compute_subdirectory_with (parent_path: ABSTRACT_STRING, entry_name: ABSTRACT_STRING)
effective procedure
{ANY}
Try to compute in the last_entry buffer the new subdirectory path obtained when trying to concatenate smartly parent_path with some entry_name.
compute_file_path_with (parent_path: ABSTRACT_STRING, file_name: ABSTRACT_STRING)
effective procedure
{ANY}
Try to compute in the last_entry buffer the new file path obtained when trying to concatenate smartly parent_path with some file_name.
compute_absolute_file_path_with (path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to compute an absolute path equivalent to path and store it in last_entry.
compute_short_name_of (path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to find the short name of the file or directory given by its path and store it in last_entry.
valid_path (path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Is the syntax of path valid for the system notation?
change_current_working_directory (directory_path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to change the current working directory using some directory_path.
current_working_directory: FIXED_STRING
effective function
{ANY}
The current working directory.
ensure_system_notation
once procedure
{ANY}
require_system_notation: BOOLEAN
once function
{ANY}
Same as ensure_system_notation, useful for contracts
create_new_directory (directory_path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Try to create a new directory using the directory_path name.
remove_directory (directory_path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Try to remove directory directory_path which must be empty.
remove_files_of (directory_path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to remove all files (not subdirectories) of directory specified by directory_path.
remove_recursively (directory_path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Try to remove all files and all subdirectories of directory specified by directory_path.
is_case_sensitive: BOOLEAN
effective function
{ANY}
system_notation: DIRECTORY_NOTATION
effective function
{ANY}
system_notation_buffer: REFERENCE[DIRECTORY_NOTATION]
once function
Unique common buffer to memorize the system path notation.
system_notation_detected: BOOLEAN
effective function
unix_notation: BOOLEAN
effective function
The Unix like file path notation looks like:
  /LibertyEiffel/sys/system.se
windows_notation: BOOLEAN
effective function
The Windows like file path notation looks like:
  C:\LibertyEiffel\sys\system.se
cygwin_notation: BOOLEAN
effective function
The Cygwin like file path notation looks like:
  //C/LibertyEiffel/sys/system.se
openvms_notation: BOOLEAN
effective function
The VMS file path notation looks like:
   DISK:[LibertyEiffel.sys]system.se
The current working directory notation is:
   DISK:[]
The equivalent of Unix ..
set_notation_using (some_path: ABSTRACT_STRING)
effective procedure
Try to detect automatically the file system notation.
reset_notation_using (some_path: ABSTRACT_STRING)
effective procedure
Try to detect automatically the file system notation.
reset_notation
effective procedure
tmp_path: STRING
once function
{}
directory_open (path_pointer: POINTER): POINTER
{}
Try to open some existing directory using path.
directory_read_entry (dirstream: POINTER): POINTER
{}
Read an return a new entry using the directory handle dirstream obtained with function basic_directory_open.
directory_get_entry_name (entry: POINTER): POINTER
{}
Read an return a new entry using the directory handle dirstream obtained with function basic_directory_open.
directory_close (dirstream: POINTER): BOOLEAN
{}
Try to close some opened dirstream directory.
directory_current_working_directory: POINTER
{}
Try to get the current working directory path.
directory_chdir (destination: POINTER): BOOLEAN
{}
Try to change the current working directory using destination.
directory_mkdir (directory_path: POINTER): BOOLEAN
{}
Try to create a new directory using directory_path.
directory_rmdir (directory_path: POINTER): BOOLEAN
{}
Try to remove directory_path.