class WINDOWS_DIRECTORY_NOTATION

Features exported to INTERNALS_HANDLER

The Windows like file path notation looks like:

  C:\SmartEiffel\sys\system.se

Direct parents

conformant parents

DIRECTORY_NOTATION

Summary

exported features

Details

is_current_directory (path: STRING): BOOLEAN
is_parent_directory (path: STRING): BOOLEAN
to_parent_directory (some_path: STRING)

Tries to compute in some_path (which may be either a file path or a directory path) the parent directory of some_path. When some_path is a path with no parent directory, some_path is_empty after this call. This operation does not perform any disk access.

require

  • is_valid_path(some_path)

to_subdirectory_with (parent_path: STRING, entry_name: STRING)

Try to compute in parent_path the new subdirectory path obtained when trying to concatenate smartly parent_path whith some entry_name. When this fails, parent_path is_empty after this call. This operation does not perform any disk access.

require

  • is_valid_path(parent_path)
  • is_valid_file_name(entry_name)

ensure

  • entry_name.is_equal(old entry_name.twin)

to_file_path_with (parent_path: STRING, file_name: STRING)

Try to compute in parent_path the new file path obtained when trying to concatenate smartly parent_path whith some file_name. When this fails, parent_path is_empty after this call. This operation does not perform any disk access.

require

  • is_valid_path(parent_path)
  • is_valid_file_name(file_name)

ensure

  • file_name.is_equal(old file_name.twin)

to_subpath_with (parent_path: STRING, subpath: STRING)

Try to compute in parent_path the new file path obtained when trying to concatenate smartly parent_path whith some subpath. When this fails, parent_path is_empty after this call. This operation does not perform any disk access.

require

  • is_valid_directory_path(parent_path)
  • is_valid_path(subpath)
  • not is_absolute_path(subpath)

ensure

  • parent_path.is_empty or else is_valid_path(parent_path)
  • parent_path.is_empty or else is_valid_directory_path(parent_path) = old is_valid_directory_path(subpath)
  • parent_path.is_empty or else is_absolute_path(parent_path) = old is_absolute_path(parent_path)

can_map_drive (source_notation: DIRECTORY_NOTATION, drive: STRING): BOOLEAN
to_root (source_notation: DIRECTORY_NOTATION, drive: STRING)

Convert drive from a drive letter/device name in source_notation to an absolute path in Current notation.

require

  • can_map_drive(source_notation, drive)

ensure

  • is_valid_path(drive)
  • is_absolute_path(drive)

to_default_root (directory: STRING)

ensure

  • is_valid_path(directory)
  • is_absolute_path(directory)

to_current_directory (directory: STRING)

Put the realtive directory representing the current working directory into directory. Not to be confused with the absolute path of the current working directory at a given time. This operation does not perform any disk access.

require

  • directory /= Void

ensure

  • is_valid_path(directory)
  • not is_absolute_path(directory)

is_case_sensitive: BOOLEAN
is_valid_path (path: STRING): BOOLEAN

Does path represent a syntactically valid file or directory path? The result does not imply that there is actually a file or directory with that name. This operation does not perform any disk access.

ensure

  • path.is_equal(old path.twin)
  • Result implies not path.is_empty

is_valid_directory_path (path: STRING): BOOLEAN

Does path represent a syntactically valid directory path? For many Systems, there may be no syntactical difference between file paths and directory paths, in that cas there is no difference between is_valid_directory_path and is_valid_path.

ensure

  • path.is_equal(old path.twin)
  • Result implies is_valid_path(path)

is_valid_file_name (name: STRING): BOOLEAN

Does path only contain valid characters for a file? The result does not imply that there is actually a file or directory with that name. Not the same as is_valid_path: path separators (/ for unix, \ for windows, ...) are allowed in paths, but not in file names. This operation does not perform any disk access.

ensure

  • name.is_equal(old name.twin)
  • Result implies not name.is_empty

is_absolute_path (path: STRING): BOOLEAN

Is path absolute, i.e. is its meaning independent of current drive and working directory ? This operation does not perform any disk access.

require

  • is_valid_path(path)

ensure

  • path.is_equal(old path.twin)

frozen to_absolute_path_in (possible_parent: STRING, path: STRING)

If path is not absolute, make it so by appending it to possible_parent. Else, overwrite possible_parent with path.

require

  • is_valid_directory_path(possible_parent)
  • is_absolute_path(possible_parent)
  • is_valid_path(path)

ensure

  • is_absolute_path(possible_parent)

frozen from_notation (source_notation: DIRECTORY_NOTATION, path: STRING)

Convert path from source_notation to Current notation. If this fails, then path is_empty after this call.

require

  • source_notation.is_valid_path(path)

ensure

  • path.is_empty or else is_valid_path(path)

can_sanitize (name: STRING): BOOLEAN
to_valid_file_name (name: STRING)

Sanitize name (by removing forbidden characters or encoding them)

require

  • name /= Void
  • not is_valid_file_name(name)
  • can_sanitize(name)

ensure

  • is_valid_file_name(name)