note description: "[ File utilities, for retrieving files and folders and formatting paths. ]" legal: "See notice at end of class." status: "See notice at end of class." date: "$Date: 2020-04-04 18:39:52 +0000 (Sat, 04 Apr 2020) $" revision: "$Revision: 104028 $" expanded class interface FILE_UTILITIES create default_create -- Process instances of classes with no creation clause. -- (Default: do nothing.) -- (from ANY) feature -- Access generating_type: TYPE [detachable FILE_UTILITIES] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal alias "≡≡≡" (other: FILE_UTILITIES): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: FILE_UTILITIES): BOOLEAN -- Is other attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal alias "≜" (other: FILE_UTILITIES): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) feature -- Duplication copy (other: FILE_UTILITIES) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: FILE_UTILITIES) -- Effect equivalent to that of: -- copy (other . deep_twin) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: FILE_UTILITIES -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: FILE_UTILITIES) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: FILE_UTILITIES -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: FILE_UTILITIES -- New object equal to Current -- twin calls copy; to change copying/twinning semantics, redefine copy. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: detachable FILE_UTILITIES -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.default for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Directory operations create_directory (a_path: READABLE_STRING_GENERAL) -- Creates a directory and any parent directories if they do not exist. -- -- a_path: The directory to create. require a_path_attached: a_path /= Void not_a_path_is_empty: not a_path.is_empty ensure class create_directory_path (a_path: PATH) -- Creates a directory and any parent directories if they do not exist. -- -- a_path: The path to create. require a_path_attached: a_path /= Void not_a_path_is_empty: not a_path.is_empty ensure class directory_exists (n: READABLE_STRING_GENERAL): BOOLEAN -- Does directory of name n exist? directory_names (n: READABLE_STRING_32): detachable ARRAYED_LIST [STRING_32] -- List of directory names (excluding current and parent directory) in directory with name n. -- Or void if directory is not readable (does not exist, cannot be accessed, etc.). directory_path_exists (p: PATH): BOOLEAN -- Does directory of path p exist? file_names (n: READABLE_STRING_32): detachable ARRAYED_LIST [STRING_32] -- List of file names in directory with name n. -- Or void if directory is not readable (does not exist, cannot be accessed, etc.). feature -- File name operations make_directory_name_in (name: READABLE_STRING_GENERAL; location: READABLE_STRING_GENERAL): READABLE_STRING_GENERAL -- A directory name for directory name in directory location. make_file_name_in (name: READABLE_STRING_GENERAL; location: READABLE_STRING_GENERAL): READABLE_STRING_GENERAL -- A file name for file name in directory location. feature -- File operations copy_file (old_name, new_name: READABLE_STRING_GENERAL) -- Copy file named old_name to new_name. copy_file_path (old_path, new_path: PATH) -- Copy file named old_path to new_path. file_exists (n: READABLE_STRING_GENERAL): BOOLEAN -- Does file of name n exist? file_path_exists (p: PATH): BOOLEAN -- Does file of path p exist? rename_file (old_name, new_name: READABLE_STRING_GENERAL) -- Rename file named old_name to new_name. rename_file_path (old_path, new_path: PATH) -- Rename file named old_path to new_path. feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void feature -- Query frozen compact_path (a_path: READABLE_STRING_32): detachable STRING_32 -- Compacts a file path, removing . and .. -- -- a_path: A path to compact. -- Result: The compacted path or Void if the path could not be compacted. require a_path_attached: a_path /= Void not_a_path_is_empty: not a_path.is_empty ends_with (a_folder: PATH; a_end_with: READABLE_STRING_GENERAL; a_levels: INTEGER_32): ARRAYED_LIST [PATH] -- Scans a folder for matching files. -- -- a_folder: Folder location to scan. -- a_levels: Number of levels to recursively scan. 0 to scan the specified folder only, -1 to scan all folders. -- a_end_with: A string results end with, ignoring cases. require a_folder_exists: directory_path_exists (a_folder) a_levels_is_valid: a_levels >= -1 invariant -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) note copyright: "Copyright (c) 1984-2020, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" licensing_options: "http://www.eiffel.com/licensing" copying: "[ This file is part of Eiffel Software's Eiffel Development Environment. Eiffel Software's Eiffel Development Environment is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License (available at the URL listed under "license" above). Eiffel Software's Eiffel Development Environment is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eiffel Software's Eiffel Development Environment; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ]" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class FILE_UTILITIES
Generated by ISE EiffelStudio