+
Point of view
All features
expanded class XDG
Summary
freedesktop.org management
Direct parents
Insert list: BASIC_DIRECTORY, FILE_TOOLS
Overview
Features
{ANY}
{ANY}
{}
{}
{}
{}
{ANY}
{}
{}
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}
{}
set_package (a_package: ABSTRACT_STRING)
once procedure
{ANY}
Be sure to call that method before any other!!
require ensure
  • is_set: package.same_as(a_package)
package: FIXED_STRING
effective function
{ANY}
read_data (filename: ABSTRACT_STRING): TEXT_FILE_READ
effective function
{ANY}
require ensure
  • Result /= Void implies Result.is_connected
read_config (filename: ABSTRACT_STRING): TEXT_FILE_READ
effective function
{ANY}
require ensure
  • Result /= Void implies Result.is_connected
cache_home: FIXED_STRING
once function
{ANY}
require
runtime_dir: FIXED_STRING
once function
{ANY}
require
data_home: FIXED_STRING
once function
{ANY}
require
config_home: FIXED_STRING
once function
{ANY}
require
effective function
{}
ensure
  • Result /= Void implies Result.is_connected
data_home_: FIXED_STRING
once function
{}
config_home_: FIXED_STRING
once function
{}
once function
{}
once function
{}
once function
{}
config_dirs: TRAVERSABLE[FIXED_STRING]
once function
{}
check_dir (dir: FIXED_STRING)
effective procedure
{}
require
  • dir /= Void
split_dirs (value: FIXED_STRING, dirs: FAST_ARRAY[FIXED_STRING])
effective procedure
{}
require
  • value /= Void
  • dirs /= Void
require
  • var /= Void
ensure
  • Result /= Void
package_name: REFERENCE[FIXED_STRING]
once function
{}
_inline_agent10: ABSTRACT_STRING
frozen
effective function
{}
_inline_agent11 (tmp: ABSTRACT_STRING): ABSTRACT_STRING
frozen
effective function
{}
_inline_agent12: ABSTRACT_STRING
frozen
effective function
{}
_inline_agent13: ABSTRACT_STRING
frozen
effective function
{}
_inline_agent14: ABSTRACT_STRING
frozen
effective function
{}
_inline_agent15: ABSTRACT_STRING
frozen
effective function
{}
_inline_agent16: ABSTRACT_STRING
frozen
effective function
{}
_inline_agent17: ABSTRACT_STRING
frozen
effective function
{}
same_files (path1: ABSTRACT_STRING, path2: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
True if the path1 file exists and has the very same content as file path2.
require
  • path1 /= Void
  • path2 /= Void
same_physical_file (path1: ABSTRACT_STRING, path2: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
True if path1 and path2 physically refer to the same file (e.g. symlinks to a same file will return True here)
require
  • path1 /= Void
  • path2 /= Void
file_exists (path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
require
  • path /= Void
  • path.count > 0
is_readable (path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
True if path file exists and is either a readable file or an accessible directory.
require
  • path /= Void
is_empty (path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
True if path file exists, is readable and is an empty file.
require
  • path /= Void
  • not path.is_empty
rename_to (old_path: ABSTRACT_STRING, new_path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to change the name or the location of a file.
require
  • old_path /= Void
  • new_path /= Void
last_rename_succeeded: BOOLEAN
writable attribute
{ANY}
True if the last call to rename_to` was successful.
copy_to (source_path: ABSTRACT_STRING, target_path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to copy the source into the target.
require
  • source_path /= Void
  • target_path /= Void
last_copy_succeeded: BOOLEAN
writable attribute
{ANY}
True if the last call to copy_to` was successful.
delete (path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to delete the given path file.
require
  • path /= Void
last_delete_succeeded: BOOLEAN
writable attribute
{ANY}
True if the last call to delete` was successful.
size_of (path: ABSTRACT_STRING): INTEGER_32
effective function
{ANY}
Total size of file path in number of bytes.
When the corresponding file does not exists, the Result is negative.
require
  • path /= Void
  • path.count > 0
last_change_of (path: ABSTRACT_STRING): TIME
effective function
{ANY}
Of the last modification of path.
require
  • path /= Void
  • path.count > 0
is_file (path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Is path a regular file?
require
  • path /= Void
  • path.count > 0
is_directory (path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Is path a directory?
require
  • path /= Void
  • path.count > 0
io_remove (path: POINTER): BOOLEAN
{}
To implement delete.
io_rename (old_path: POINTER, new_path: POINTER): BOOLEAN
{}
io_copy (source: POINTER, target: POINTER): BOOLEAN
{}
io_file_exists (path: POINTER): BOOLEAN
{}
io_same_physical_file (path1: POINTER, path2: POINTER): BOOLEAN
{}
fstat_st_size (path: POINTER): INTEGER_32
{}
fstat_st_mtime (path: POINTER): INTEGER_64
{}
fstat_st_is_file (path: POINTER): BOOLEAN
{}
fstat_st_is_dir (path: POINTER): BOOLEAN
{}
once function
{}
once function
{}
tmp_string: STRING
once function
{}
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 ?
require
connect_to (directory_path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to connect Current to some existing directory_path.
After this call, the client supposed to use is_connected to check that the stream is ready to be used.
require ensure
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.
When some_path is the path of some readable existing directory, this directory is opened and the effect of connect_with is equivalent to connect_to. When some_path is not an existing readable directory path, connect_with tries to open the directory which may contains some_path viewed as a file path name. After this call, the client is supposed to use is_connected to check that the stream is ready to be used and the last_entry buffer to know about the corresponding opened directory path. Whatever the result, some_path is left unchanged.
require ensure
connect_to_current_working_directory
effective procedure
{ANY}
Try to connect Current to the current working directory.
After this call, the client is supposed to use is_connected to check that the stream is ready to be used and the last_entry buffer to know about the name of the current working directory.
require ensure
disconnect
effective procedure
{ANY}
Do not forget to call this feature when you have finished with some previously opened directory stream.
require ensure
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.
When some_path is a path with no parent directory, the last_entry buffer is_empty after this call. This operation does not perform any disk access.
require
  • not some_path.is_empty
  • common_buffer_protection: last_entry /= 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.
When this fails the last_entry buffer is_empty after this call. This operation does not perform any disk access. Whatever the result, parent_path and entry_name are left unchanged.
require
  • not parent_path.is_empty
  • not entry_name.is_empty
  • common_buffer_protection1: last_entry /= parent_path
  • common_buffer_protection2: last_entry /= 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.
When this fails the last_entry buffer is_empty after this call. This operation does not perform any disk access. Whatever the result, parent_path and file_name are left unchanged.
require
  • not parent_path.is_empty
  • not file_name.is_empty
  • common_buffer_protection1: last_entry /= parent_path
  • common_buffer_protection2: last_entry /= 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.
When this fails the last_entry buffer is_empty after this call. This operation does not perform any disk access. Whatever the result, path is left unchanged.
require ensure
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.
When this fails the last_entry buffer is_empty after the call. This operation does not perform any disk access. Whatever the result, path is left unchanged.
valid_path (path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Is the syntax of path valid for the system notation?
ensure
change_current_working_directory (directory_path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to change the current working directory using some directory_path.
 When the operation
possible, the last_entry buffer is updated with the new current working directory path,
otherwise, when the modification is not possible the last_entry buffer is_empty after this
call. Whatever the result, directory_path is left unchanged.
require ensure
current_working_directory: FIXED_STRING
effective function
{ANY}
The current working directory.
Always returns the same once STRING.
ensure_system_notation
once procedure
{ANY}
ensure
require_system_notation: BOOLEAN
once function
{ANY}
Same as ensure_system_notation, useful for contracts
ensure
create_new_directory (directory_path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Try to create a new directory using the directory_path name.
Returns True on success.
require ensure
remove_directory (directory_path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Try to remove directory directory_path which must be empty.
Returns True on success.
require ensure
remove_files_of (directory_path: ABSTRACT_STRING)
effective procedure
{ANY}
Try to remove all files (not subdirectories) of directory specified by directory_path.
require ensure
remove_recursively (directory_path: ABSTRACT_STRING): BOOLEAN
effective function
{ANY}
Try to remove all files and all subdirectories of directory specified by directory_path.
require ensure
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
set_notation_using (some_path: ABSTRACT_STRING)
effective procedure
Try to detect automatically the file system notation.
require
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.
When Result is_not_null, the directory correctly opened and Result is a valid handle for this directory. Using Result, one can then scan the content of the directory using function basic_directory_read_entry and basic_directory_get_entry_name. Finally, a is_not_null directory must be closed using function basic_directory_close.
require
  • path_pointer.is_not_null
directory_read_entry (dirstream: POINTER): POINTER
{}
Read an return a new entry using the directory handle dirstream obtained with function basic_directory_open.
When there is no more entry, the Result becomes is_null.
require
  • dirstream.is_not_null
directory_get_entry_name (entry: POINTER): POINTER
{}
Read an return a new entry using the directory handle dirstream obtained with function basic_directory_open.
When there is no more entry, the Result becomes is_null.
require
  • entry.is_not_null
directory_close (dirstream: POINTER): BOOLEAN
{}
Try to close some opened dirstream directory.
A True result indicates that the directory correctly closed.
require
  • dirstream.is_not_null
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.