/src/lib/io/filesystem/path_name/macintosh_directory_notation.e

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