+
Point of view
All features
expanded class FILE_TOOLS
Summary
This expanded class gather tools relatives to files such as file comparison, file renaming, file deletion, file size, file permissions...
Note this is a facilities class. Files are referenced with their names (as STRINGs). Consider using functions available in TEXT_FILE_READ if you are already connected to the file.
Direct parents
Insert list: ANY
Known children
Insert list: XDG
Overview
Features
{ANY}
{}
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
{}