/src/lib/io/filesystem/path_name/macintosh_directory_notation.e
Specman e | 149 lines | 102 code | 19 blank | 28 comment | 6 complexity | 916d555f1b912088261ca03421b47684 MD5 | raw file
1-- This file is part of a Liberty Eiffel library. 2-- See the full copyright at the end. 3-- 4class MACINTOSH_DIRECTORY_NOTATION 5 -- The Macintosh file path notation looks like: 6 -- :SmartEiffel:sys:system.se 7 8inherit 9 DIRECTORY_NOTATION 10 11feature {ANY} 12 is_current_directory (path: STRING): BOOLEAN is 13 do 14 not_yet_implemented 15 end 16 17 is_parent_directory (path: STRING): BOOLEAN is 18 do 19 not_yet_implemented 20 end 21 22 to_parent_directory (some_path: STRING) is 23 do 24 from 25 some_path.remove_last 26 until 27 some_path.is_empty or else some_path.last = ':' 28 loop 29 some_path.remove_last 30 end 31 if not some_path.is_empty then 32 some_path.extend_unless(':') 33 end 34 end 35 36 to_subdirectory_with (parent_path, entry_name: STRING) is 37 do 38 parent_path.extend_unless(':') 39 if entry_name.first = ':' then 40 parent_path.remove_last 41 end 42 parent_path.append(entry_name) 43 parent_path.extend_unless(':') 44 end 45 46 to_file_path_with (parent_path, file_name: STRING) is 47 do 48 parent_path.extend_unless(':') 49 if file_name.first = ':' then 50 parent_path.remove_last 51 end 52 parent_path.append(file_name) 53 end 54 55 to_subpath_with (parent_path, subpath: STRING) is 56 do 57 parent_path.extend_unless(':') 58 parent_path.append(subpath) 59 end 60 61 to_directory_path (path: STRING) is 62 do 63 path.extend_unless(':') 64 end 65 66 to_short_name_in (buffer, path: STRING) is 67 local 68 i: INTEGER 69 do 70 buffer.copy(path) 71 if buffer.last = ':' then 72 buffer.remove_last 73 end 74 i := buffer.last_index_of(':') 75 if i >= 0 then 76 buffer.shrink(i + 1, buffer.count) 77 end 78 end 79 80feature {ANY} 81 can_map_drive (source_notation: DIRECTORY_NOTATION; drive: STRING): BOOLEAN is 82 do 83 --|*** We (c/sh)ould do better than nothing... <24/03/2005> 84 end 85 86 to_root (source_notation: DIRECTORY_NOTATION; drive: STRING) is 87 do 88 check 89 False 90 end 91 end 92 93 to_default_root (directory: STRING) is 94 do 95 not_yet_implemented 96 end 97 98 to_current_directory (directory: STRING) is 99 do 100 not_yet_implemented 101 end 102 103feature {ANY} 104 is_case_sensitive: BOOLEAN is True 105 106 is_valid_path, is_valid_directory_path (path: STRING): BOOLEAN is 107 do 108 --|*** Not nearly strict enough <FM-24/03/2003> 109 Result := not path.is_empty 110 end 111 112 is_valid_file_name (name: STRING): BOOLEAN is 113 do 114 --|*** Not nearly strict enough <FM-24/03/2003> 115 Result := not name.is_empty 116 end 117 118 is_absolute_path (path: STRING): BOOLEAN is 119 do 120 not_yet_implemented 121 end 122 123feature {DIRECTORY_NOTATION} 124 to_notation (path: STRING; destination_notation: DIRECTORY_NOTATION): STRING is 125 do 126 not_yet_implemented 127 end 128 129end -- class MACINTOSH_DIRECTORY_NOTATION 130-- 131-- Copyright (c) 2009 by all the people cited in the AUTHORS file. 132-- 133-- Permission is hereby granted, free of charge, to any person obtaining a copy 134-- of this software and associated documentation files (the "Software"), to deal 135-- in the Software without restriction, including without limitation the rights 136-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 137-- copies of the Software, and to permit persons to whom the Software is 138-- furnished to do so, subject to the following conditions: 139-- 140-- The above copyright notice and this permission notice shall be included in 141-- all copies or substantial portions of the Software. 142-- 143-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 144-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 145-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 146-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 147-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 148-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 149-- THE SOFTWARE.