expanded class FILE_TOOLS

All features

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

non-conformant parents

ANY

Summary

exported features

Details

same_files (path1: STRING, path2: STRING): BOOLEAN

True if the path1 file exists and has the very same content as file path2.

require

  • path1 /= Void
  • path2 /= Void

file_exists (path: STRING): BOOLEAN

True if path is an existing readable file.

require

  • not path.is_empty

is_readable (path: STRING): BOOLEAN

True if path file exists and is a readable file.

require

  • path /= Void

is_empty (path: STRING): BOOLEAN

True if path file exists, is readable and is an empty file.

rename_to (old_path: STRING, new_path: STRING)

Try to change the name or the location of a file.

require

  • old_path /= Void
  • new_path /= Void

copy_to (source_path: STRING, target_path: STRING)

Try to copy the source into the target.

require

  • source_path /= Void
  • target_path /= Void

delete (path: STRING)

Try to delete the given path file.

require

  • path /= Void

size_of (path: STRING): INTEGER

Total size of file path in number of bytes.

require

  • file_exists(path)

last_change_of (path: STRING): TIME

Of the last modification of path.

require

  • file_exists(path)

is_file (path: STRING): BOOLEAN

Is path a regular file?

require

  • file_exists(path)

is_directory (path: STRING): BOOLEAN

Is path a direcory?

require

  • file_exists(path)

io_remove (path: POINTER)

To implement delete.

io_rename (old_path: POINTER, new_path: POINTER)
io_copy (source: POINTER, target: POINTER)
io_file_exists (path: POINTER): BOOLEAN
fstat_st_size (path: POINTER): INTEGER
fstat_st_mtime (path: POINTER): INTEGER_64
fstat_st_is_file (path: POINTER): BOOLEAN
fstat_st_is_dir (path: POINTER): BOOLEAN
tfr1: TEXT_FILE_READ
tfr2: TEXT_FILE_READ
tmp_string: STRING