| 1 |
@comment{ $Source: e:\\cvsroot/ARM/Source/pre_dirs.mss,v $ } |
| 2 |
@comment{ $Revision: 1.49 $ $Date: 2012/11/28 23:53:05 $ $Author: randy $ } |
| 3 |
@Part(predefdirs, Root="ada.mss") |
| 4 |
|
| 5 |
@Comment{$Date: 2012/11/28 23:53:05 $} |
| 6 |
|
| 7 |
@RMNewPageVer{Version=[2]}@Comment{For printed version of Ada 2005 RM} |
| 8 |
@LabeledAddedClause{Version=[2],Name=[The Package Directories]} |
| 9 |
|
| 10 |
@begin{Intro} |
| 11 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 12 |
@ChgAdded{Version=[2],Text=[The package Directories provides operations |
| 13 |
for manipulating files and directories, and their names.]} |
| 14 |
@begin{Discussion} |
| 15 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 16 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 17 |
@ChgAdded{Version=[2],Text=[The notes for this @Chg{Version=[3],New=[subclause],Old=[clause]} |
| 18 |
contain the expected |
| 19 |
interpretations of some of the operations on various target systems. |
| 20 |
@lquotes@;Unix@rquotes@; refers to the UNIX@latin1(174) operating system, |
| 21 |
and in most cases also covers Unix-like systems such as Linux and POSIX. |
| 22 |
@lquotes@;Windows@latin1(174)@rquotes@; refers to the Microsoft@latin1(174) |
| 23 |
Windows@latin1(174) 2000 operating system and usually also covers most |
| 24 |
other versions that use the Win32 API.]} |
| 25 |
@end{Discussion} |
| 26 |
@end{Intro} |
| 27 |
|
| 28 |
@begin{StaticSem} |
| 29 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 30 |
@ChgAdded{Version=[2],KeepNext=[T],Type=[Leading],Text=[The library package |
| 31 |
Directories has the following declaration:]} |
| 32 |
@begin{Example} |
| 33 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 34 |
@ChgAdded{Version=[2],Text=[@key{with} Ada.IO_Exceptions; |
| 35 |
@key{with} Ada.Calendar; |
| 36 |
@key{package} Ada.Directories @key{is}@ChildUnit{Parent=[Ada],Child=[Directories]}]} |
| 37 |
|
| 38 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 39 |
@ChgAdded{Version=[2],Text=[ -- @RI[Directory and file operations:]]} |
| 40 |
|
| 41 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 42 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Current_Directory} @key{return} String;]} |
| 43 |
|
| 44 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 45 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Set_Directory} (Directory : in String);]} |
| 46 |
|
| 47 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 48 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Create_Directory} (New_Directory : @key{in} String; |
| 49 |
Form : @key{in} String := "");]} |
| 50 |
|
| 51 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 52 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Delete_Directory} (Directory : @key{in} String);]} |
| 53 |
|
| 54 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 55 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Create_Path} (New_Directory : @key{in} String; |
| 56 |
Form : @key{in} String := "");]} |
| 57 |
|
| 58 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 59 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Delete_Tree} (Directory : @key{in} String);]} |
| 60 |
|
| 61 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 62 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Delete_File} (Name : @key{in} String);]} |
| 63 |
|
| 64 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 65 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Rename} (Old_Name, New_Name : @key{in} String);]} |
| 66 |
|
| 67 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 68 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Copy_File} (Source_Name, |
| 69 |
Target_Name : @key{in} String; |
| 70 |
Form : @key{in} String := "");]} |
| 71 |
|
| 72 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 73 |
@ChgAdded{Version=[2],Text=[ -- @RI[File and directory name operations:]]} |
| 74 |
|
| 75 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 76 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Full_Name} (Name : @key{in} String) @key{return} String;]} |
| 77 |
|
| 78 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 79 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Simple_Name} (Name : @key{in} String) @key{return} String;]} |
| 80 |
|
| 81 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 82 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Containing_Directory} (Name : @key{in} String) @key{return} String;]} |
| 83 |
|
| 84 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 85 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Extension} (Name : @key{in} String) @key{return} String;]} |
| 86 |
|
| 87 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 88 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Base_Name} (Name : @key{in} String) @key{return} String;]} |
| 89 |
|
| 90 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 91 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Compose} (Containing_Directory : @key{in} String := ""; |
| 92 |
Name : @key{in} String; |
| 93 |
Extension : @key{in} String := "") @key{return} String;]} |
| 94 |
|
| 95 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0049-1]} |
| 96 |
@ChgAdded{Version=[3],Text=[ @Key{type} @AdaTypeDefn{Name_Case_Kind} @key{is} |
| 97 |
(Unknown, Case_Sensitive, Case_Insensitive, Case_Preserving);]} |
| 98 |
|
| 99 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0049-1]} |
| 100 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Name_Case_Equivalence} (Name : @key{in} String) @key{return} Name_Case_Kind;]} |
| 101 |
|
| 102 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 103 |
@ChgAdded{Version=[2],Text=[ -- @RI{File and directory queries:}]} |
| 104 |
|
| 105 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 106 |
@ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{File_Kind} @key{is} (Directory, Ordinary_File, Special_File);]} |
| 107 |
|
| 108 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 109 |
@ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{File_Size} @key{is range} 0 .. @RI{implementation-defined};]} |
| 110 |
|
| 111 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 112 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Exists} (Name : @key{in} String) @key{return} Boolean;]} |
| 113 |
|
| 114 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 115 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Kind} (Name : @key{in} String) @key{return} File_Kind;]} |
| 116 |
|
| 117 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 118 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Size} (Name : @key{in} String) @key{return} File_Size;]} |
| 119 |
|
| 120 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 121 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Modification_Time} (Name : @key{in} String) @key{return} Ada.Calendar.Time;]} |
| 122 |
|
| 123 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 124 |
@ChgAdded{Version=[2],Text=[ -- @RI{Directory searching:}]} |
| 125 |
|
| 126 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 127 |
@ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{Directory_Entry_Type} @key{is limited private};]} |
| 128 |
|
| 129 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 130 |
@ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{Filter_Type} @key{is array} (File_Kind) @key{of} Boolean;]} |
| 131 |
|
| 132 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 133 |
@ChgAdded{Version=[2],Text=[ @key{type} @AdaTypeDefn{Search_Type} @key{is limited private};]} |
| 134 |
|
| 135 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 136 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Start_Search} (Search : @key{in out} Search_Type; |
| 137 |
Directory : @key{in} String; |
| 138 |
Pattern : @key{in} String; |
| 139 |
Filter : @key{in} Filter_Type := (@key{others} => True));]} |
| 140 |
|
| 141 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 142 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{End_Search} (Search : @key{in out} Search_Type);]} |
| 143 |
|
| 144 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 145 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{More_Entries} (Search : @key{in} Search_Type) @key{return} Boolean;]} |
| 146 |
|
| 147 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 148 |
@ChgAdded{Version=[2],Text=[ @key{procedure} @AdaSubDefn{Get_Next_Entry} (Search : @key{in out} Search_Type; |
| 149 |
Directory_Entry : @key{out} Directory_Entry_Type);]} |
| 150 |
|
| 151 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 152 |
@ChgAdded{Version=[2],Text=[ @key{procedure} Search ( |
| 153 |
Directory : @key{in} String; |
| 154 |
Pattern : @key{in} String; |
| 155 |
Filter : @key{in} Filter_Type := (@key{others} => True); |
| 156 |
Process : @key{not null access procedure} ( |
| 157 |
Directory_Entry : @key{in} Directory_Entry_Type));]} |
| 158 |
|
| 159 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 160 |
@ChgAdded{Version=[2],Text=[ -- @RI{Operations on Directory Entries:}]} |
| 161 |
|
| 162 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 163 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Simple_Name} (Directory_Entry : @key{in} Directory_Entry_Type) |
| 164 |
@key{return} String;]} |
| 165 |
|
| 166 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 167 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Full_Name} (Directory_Entry : @key{in} Directory_Entry_Type) |
| 168 |
@key{return} String;]} |
| 169 |
|
| 170 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 171 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Kind} (Directory_Entry : @key{in} Directory_Entry_Type) |
| 172 |
@key{return} File_Kind;]} |
| 173 |
|
| 174 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 175 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Size} (Directory_Entry : @key{in} Directory_Entry_Type) |
| 176 |
@key{return} File_Size;]} |
| 177 |
|
| 178 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 179 |
@ChgAdded{Version=[2],Text=[ @key{function} @AdaSubDefn{Modification_Time} (Directory_Entry : @key{in} Directory_Entry_Type) |
| 180 |
@key{return} Ada.Calendar.Time;]} |
| 181 |
|
| 182 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 183 |
@ChgAdded{Version=[2],Text=[ @AdaExcDefn{Status_Error} : @key{exception renames} Ada.IO_Exceptions.Status_Error; |
| 184 |
@AdaExcDefn{Name_Error} : @key{exception renames} Ada.IO_Exceptions.Name_Error; |
| 185 |
@AdaExcDefn{Use_Error} : @key{exception renames} Ada.IO_Exceptions.Use_Error; |
| 186 |
@AdaExcDefn{Device_Error} : @key{exception renames} Ada.IO_Exceptions.Device_Error;]} |
| 187 |
|
| 188 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 189 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0092-1]} |
| 190 |
@ChgAdded{Version=[2],Text=[@key{private} |
| 191 |
@Chg{Version=[3],New=[... ],Old=[]}-- @RI{@Chg{Version=[3],New=[not],Old=[Not]} specified by the language@Chg{Version=[3],New=[],Old=[.]}} |
| 192 |
@key{end} Ada.Directories;]} |
| 193 |
|
| 194 |
@end{Example} |
| 195 |
|
| 196 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 197 |
@ChgAdded{Version=[2],Text=[External files may be classified as directories, |
| 198 |
special files, or ordinary |
| 199 |
files. A @i<directory> is an external file that is a container for files on |
| 200 |
the target system. A @i<special file> is an external file that cannot be |
| 201 |
created or read by a predefined Ada input-output package. External files that |
| 202 |
are not special files or directories are called @i<ordinary files>. |
| 203 |
@Defn{directory} |
| 204 |
@Defn{special file} |
| 205 |
@Defn{ordinary file}]} |
| 206 |
@begin{Ramification} |
| 207 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 208 |
@ChgAdded{Version=[2],Text=[A directory is an external file, although it may |
| 209 |
not have a name on some targets. A directory is not a special file, as it |
| 210 |
can be created and read by Directories.]} |
| 211 |
@end{Ramification} |
| 212 |
@begin{Discussion} |
| 213 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 214 |
@ChgAdded{Version=[2],Text=[Devices and soft links are examples of |
| 215 |
special files on Windows@latin1(174) and Unix.]} |
| 216 |
|
| 217 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 218 |
@ChgAdded{Version=[2],Text=[Even if an implementation provides a package |
| 219 |
to create and read soft links, such links are still special files.]} |
| 220 |
@end{Discussion} |
| 221 |
|
| 222 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 223 |
@ChgAdded{Version=[2],Text=[A @i<file name> is a string identifying an external |
| 224 |
file. Similarly, a |
| 225 |
@i<directory name> is a string identifying a directory. The interpretation of |
| 226 |
file names and directory names is implementation-defined. |
| 227 |
@Defn{directory name} |
| 228 |
@Defn{file name}]} |
| 229 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The |
| 230 |
interpretation of file names and directory names.],Old=[]}]} |
| 231 |
|
| 232 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 233 |
@ChgAdded{Version=[2],Text=[The @i<full name> of an external file is a |
| 234 |
full specification of the name of |
| 235 |
the file. If the external environment allows alternative specifications of the |
| 236 |
name (for example, abbreviations), the full name should not use such |
| 237 |
alternatives. A full name typically will include the names of all of the |
| 238 |
directories that contain the item. The @i<simple name> of an external file is |
| 239 |
the name of the item, not including any containing directory names. Unless |
| 240 |
otherwise specified, a file name or directory name parameter in a call to |
| 241 |
a predefined Ada input-output subprogram can be a full name, a simple name, |
| 242 |
or any other form of name supported by the implementation. |
| 243 |
@Defn2{Term=[full name],Sec=[of a file]} |
| 244 |
@Defn2{Term=[simple name],Sec=[of a file]}]} |
| 245 |
@begin{Discussion} |
| 246 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 247 |
@ChgAdded{Version=[2],Text=[The full name on Unix is a complete path to the |
| 248 |
root. For Windows@latin1(174), the full name includes a complete path, as well as a disk |
| 249 |
name ("C:") or network share name. For both systems, the simple name is |
| 250 |
the part of the name following the last '/' (or '\' for Windows@latin1(174)). For |
| 251 |
example, in the name "/usr/randy/ada-directories.ads", |
| 252 |
"ada-directories.ads" is the simple name.]} |
| 253 |
@end{Discussion} |
| 254 |
@begin{Ramification} |
| 255 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 256 |
@ChgAdded{Version=[2],Text=[It is possible for a file or directory name to be |
| 257 |
neither a full name nor a simple name. For instance, the Unix name |
| 258 |
"../parent/myfile" is neither a full name nor a simple name.]} |
| 259 |
@end{Ramification} |
| 260 |
|
| 261 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 262 |
@ChgAdded{Version=[2],Text=[The @i<default directory> is the directory that is |
| 263 |
used if a directory or |
| 264 |
file name is not a full name (that is, when the name does not fully identify |
| 265 |
all of the containing directories). |
| 266 |
@Defn{default directory}]} |
| 267 |
|
| 268 |
@begin{Discussion} |
| 269 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 270 |
@ChgAdded{Version=[2],Text=[The default directory is the one maintained by |
| 271 |
the familiar @lquotes@;cd@rquotes@; command on Unix and Windows@latin1(174). Note that |
| 272 |
Windows@latin1(174) maintains |
| 273 |
separate default directories for each disk drive; implementations should |
| 274 |
use the natural implementation.]} |
| 275 |
@end{Discussion} |
| 276 |
|
| 277 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 278 |
@ChgAdded{Version=[2],Text=[A @i<directory entry> is a single item in a |
| 279 |
directory, identifying a single |
| 280 |
external file (including directories and special files). |
| 281 |
@Defn{directory entry}]} |
| 282 |
|
| 283 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 284 |
@ChgAdded{Version=[2],Text=[For each function that returns a string, the |
| 285 |
lower bound of the returned value is 1.]} |
| 286 |
|
| 287 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 288 |
@ChgAdded{Version=[2],Type=[Leading], |
| 289 |
Text=[The following file and directory operations are provided:]} |
| 290 |
|
| 291 |
@begin{DescribeCode} |
| 292 |
|
| 293 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 294 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Current_Directory @key{return} String;]} |
| 295 |
@end{Example} |
| 296 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 297 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the full directory name |
| 298 |
for the current default directory. |
| 299 |
The name returned shall be suitable for a future call to Set_Directory. |
| 300 |
The exception Use_Error is propagated if a default directory is not |
| 301 |
supported by the external environment.]} |
| 302 |
|
| 303 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 304 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Set_Directory (Directory : @key{in} String);]} |
| 305 |
@end{Example} |
| 306 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 307 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Sets the current default directory. |
| 308 |
The exception Name_Error is |
| 309 |
propagated if the string given as Directory does not identify an existing |
| 310 |
directory. The exception Use_Error is propagated if the external environment |
| 311 |
does not support making Directory (in the absence of Name_Error) a default |
| 312 |
directory.]} |
| 313 |
|
| 314 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 315 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Create_Directory (New_Directory : @key{in} String; |
| 316 |
Form : @key{in} String := "");]} |
| 317 |
@end{Example} |
| 318 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 319 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Creates a directory with name |
| 320 |
New_Directory. The Form parameter can be |
| 321 |
used to give system-dependent characteristics of the directory; the |
| 322 |
interpretation of the Form parameter is implementation-defined. A null string |
| 323 |
for Form specifies the use of the default options of the implementation of the |
| 324 |
new directory. The exception Name_Error is propagated if the string given as |
| 325 |
New_Directory does not allow the identification of a directory. The exception |
| 326 |
Use_Error is propagated if the external environment does not support the |
| 327 |
creation of a directory with the given name (in the absence of Name_Error) and |
| 328 |
form.]} |
| 329 |
|
| 330 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 331 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Delete_Directory (Directory : @key{in} String);]} |
| 332 |
@end{Example} |
| 333 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 334 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0231-1]} |
| 335 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Deletes an existing empty directory |
| 336 |
with name Directory. The exception |
| 337 |
Name_Error is propagated if the string given as Directory does not identify an |
| 338 |
existing directory. The exception Use_Error is propagated if the |
| 339 |
@Chg{Version=[3],New=[directory is not empty or the ],Old=[]}external |
| 340 |
environment does not support the deletion of the directory |
| 341 |
@Chg{Version=[3],New=[],Old=[(or some portion of its contents) ]}with |
| 342 |
the given name (in the absence of Name_Error).]} |
| 343 |
|
| 344 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 345 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Create_Path (New_Directory : @key{in} String; |
| 346 |
Form : @key{in} String := "");]} |
| 347 |
@end{Example} |
| 348 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 349 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0271-1]} |
| 350 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Creates zero or more directories with |
| 351 |
name New_Directory. Each |
| 352 |
nonexistent directory named by New_Directory is created.@Redundant[ For example, on a |
| 353 |
typical Unix system, Create_Path ("/usr/me/my"); would create directory "me" in |
| 354 |
directory "usr", then create directory "my" in directory "me".] The Form parameter |
| 355 |
can be used to give system-dependent characteristics of the directory; the |
| 356 |
interpretation of the Form parameter is implementation-defined. A null string |
| 357 |
for Form specifies the use of the default options of the implementation of the |
| 358 |
new directory. The exception Name_Error is propagated if the string given as |
| 359 |
New_Directory does not allow the identification of any directory. The exception |
| 360 |
Use_Error is propagated if the external environment does not support the |
| 361 |
creation of any directories with the given name (in the absence of Name_Error) |
| 362 |
and form.@Chg{Version=[3],New=[ If Use_Error is propagated, it is unspecified |
| 363 |
whether a portion of the directory path is created.],Old=[]}]} |
| 364 |
|
| 365 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 366 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Delete_Tree (Directory : @key{in} String);]} |
| 367 |
@end{Example} |
| 368 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 369 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Deletes an existing directory with |
| 370 |
name Directory. The directory and |
| 371 |
all of its contents (possibly including other directories) are deleted. The |
| 372 |
exception Name_Error is propagated if the string given as Directory does not |
| 373 |
identify an existing directory. The exception Use_Error is propagated if the |
| 374 |
external environment does not support the deletion of the directory or some |
| 375 |
portion of its contents with the given name (in the absence of Name_Error). If |
| 376 |
Use_Error is propagated, it is unspecified whether a portion of the contents of |
| 377 |
the directory is deleted.]} |
| 378 |
|
| 379 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 380 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Delete_File (Name : @key{in} String);]} |
| 381 |
@end{Example} |
| 382 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 383 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Deletes an existing ordinary or |
| 384 |
special file with name Name. The exception |
| 385 |
Name_Error is propagated if the string given as Name does not identify an |
| 386 |
existing ordinary or special external file. The exception Use_Error is |
| 387 |
propagated if the external environment does not support the deletion of the |
| 388 |
file with the given name (in the absence of Name_Error).]} |
| 389 |
|
| 390 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 391 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Rename (Old_Name, New_Name : @key{in} String);]} |
| 392 |
@end{Example} |
| 393 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 394 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0231-1]} |
| 395 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Renames an existing external file |
| 396 |
(including directories) with name Old_Name |
| 397 |
to New_Name. The exception Name_Error is propagated if the string given as |
| 398 |
Old_Name does not identify an existing external file@Chg{Version=[3],New=[ |
| 399 |
or if the string given as New_Name does not allow the identification |
| 400 |
of an external file],Old=[]}. The exception Use_Error |
| 401 |
is propagated if the external environment does not support the renaming of the |
| 402 |
file with the given name (in the absence of Name_Error). In particular, |
| 403 |
Use_Error is propagated if a file or directory already exists with name |
| 404 |
New_Name.]} |
| 405 |
|
| 406 |
@begin{ImplNote} |
| 407 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 408 |
@ChgAdded{Version=[2],Text=[This operation is expected to work within a |
| 409 |
single directory, and implementers are encouraged to support it across |
| 410 |
directories on a single device. Copying files from one device to another |
| 411 |
is discouraged (that's what Copy_File is for). However, there is no |
| 412 |
requirement to detect file copying by the target system. If the target |
| 413 |
system has an API that gives that for @lquotes@;free@rquotes, it can be |
| 414 |
used. For Windows@latin1(174), for instance, MoveFile can be used to |
| 415 |
implement Rename.]} |
| 416 |
@end{ImplNote} |
| 417 |
|
| 418 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 419 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0092-1]} |
| 420 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Copy_File (Source_Name, |
| 421 |
Target_Name : @key{in} String; |
| 422 |
Form : @key{in} String@Chg{Version=[3],New=[ := ""],Old=[]});]} |
| 423 |
@end{Example} |
| 424 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 425 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0271-1]} |
| 426 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Copies the contents of the existing |
| 427 |
external file with name Source_Name to an external file with name Target_Name. |
| 428 |
The resulting external file is a duplicate of the source external file. The |
| 429 |
Form parameter can be used to give system-dependent characteristics of the |
| 430 |
resulting external file; the interpretation of the Form parameter is |
| 431 |
implementation-defined. Exception Name_Error is propagated if the string given |
| 432 |
as Source_Name does not identify an existing external ordinary or special file, |
| 433 |
or if the string given as Target_Name does not allow the identification of an |
| 434 |
external file. The exception Use_Error is propagated if the external |
| 435 |
environment does not support creating the file with the name given by |
| 436 |
Target_Name and form given by Form, or copying of the file with the name given |
| 437 |
by Source_Name (in the absence of Name_Error).@Chg{Version=[3],New=[ If |
| 438 |
Use_Error is propagated, it is unspecified whether a portion of the file |
| 439 |
is copied.],Old=[]}]} |
| 440 |
@begin{Ramification} |
| 441 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 442 |
@ChgAdded{Version=[2],Text=[Name_Error is always raised if Source_Name |
| 443 |
identifies a directory. It is up to the implementation whether |
| 444 |
special files can be copied, or if Use_Error will be raised.]} |
| 445 |
@end{Ramification} |
| 446 |
|
| 447 |
@end{DescribeCode} |
| 448 |
|
| 449 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 450 |
@ChgAdded{Version=[2],Type=[Leading],Text=[The following file and directory |
| 451 |
name operations are provided:]} |
| 452 |
|
| 453 |
@begin{DescribeCode} |
| 454 |
|
| 455 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 456 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Full_Name (Name : @key{in} String) @key{return} String;]} |
| 457 |
@end{Example} |
| 458 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 459 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the full name corresponding |
| 460 |
to the file name specified by |
| 461 |
Name. The exception Name_Error is propagated if the string given as Name does |
| 462 |
not allow the identification of an external file (including directories and |
| 463 |
special files).]} |
| 464 |
@begin{Discussion} |
| 465 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 466 |
@ChgAdded{Version=[2],Text=[Full name means that no abbreviations are |
| 467 |
used in the returned name, and that it is a full specification of the name. |
| 468 |
Thus, for Unix and Windows@latin1(174), the result should be a full path that does not |
| 469 |
contain any "." or ".." directories. Typically, the default directory |
| 470 |
is used to fill in any missing information.]} |
| 471 |
@end{Discussion} |
| 472 |
|
| 473 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 474 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Simple_Name (Name : @key{in} String) @key{return} String;]} |
| 475 |
@end{Example} |
| 476 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 477 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the simple name portion of |
| 478 |
the file name specified by Name. |
| 479 |
The exception Name_Error is propagated if the string given as Name does not |
| 480 |
allow the identification of an external file (including directories and special |
| 481 |
files).]} |
| 482 |
|
| 483 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 484 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Containing_Directory (Name : @key{in} String) @key{return} String;]} |
| 485 |
@end{Example} |
| 486 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 487 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the name of the containing |
| 488 |
directory of the external file |
| 489 |
(including directories) identified by Name. (If more than one directory can |
| 490 |
contain Name, the directory name returned is implementation-defined.) The |
| 491 |
exception Name_Error is propagated if the string given as Name does not allow |
| 492 |
the identification of an external file. The exception Use_Error is propagated |
| 493 |
if the external file does not have a containing directory.]} |
| 494 |
@begin{Discussion} |
| 495 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 496 |
@ChgAdded{Version=[2],Text=[This is purely a string manipulation function. |
| 497 |
If Name is not given as a full name, the containing directory probably |
| 498 |
won't be one, either. For example, if Containing_Directory ("..\AARM\RM-A-8") |
| 499 |
is called on Windows@latin1(174), the result should be "..\AARM". If there is no |
| 500 |
path at all on the name, the result should be "." (which represents the |
| 501 |
current directory). Use Full_Name on the result of Containing_Directory |
| 502 |
if the full name is needed.]} |
| 503 |
@end{Discussion} |
| 504 |
|
| 505 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 506 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Extension (Name : @key{in} String) @key{return} String;]} |
| 507 |
@end{Example} |
| 508 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 509 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the extension name |
| 510 |
corresponding to Name. The extension name |
| 511 |
is a portion of a simple name (not including any separator characters), |
| 512 |
typically used to identify the file class. If the external environment does not |
| 513 |
have extension names, then the null string is returned. The exception |
| 514 |
Name_Error is propagated if the string given as Name does not allow the |
| 515 |
identification of an external file.]} |
| 516 |
@begin{Discussion} |
| 517 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 518 |
@ChgAdded{Version=[2],Text=[For Unix and Windows@latin1(174), the extension is the |
| 519 |
portion of the simple name following the rightmost period. For example, |
| 520 |
in the simple name "RM-A-8.html", the extension is "html".]} |
| 521 |
@end{Discussion} |
| 522 |
|
| 523 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 524 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Base_Name (Name : @key{in} String) @key{return} String;]} |
| 525 |
@end{Example} |
| 526 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 527 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the base name corresponding |
| 528 |
to Name. The base name is the |
| 529 |
remainder of a simple name after removing any extension and extension |
| 530 |
separators. The exception Name_Error is propagated if the string given as Name |
| 531 |
does not allow the identification of an external file (including directories and |
| 532 |
special files).]} |
| 533 |
@begin{Discussion} |
| 534 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 535 |
@ChgAdded{Version=[2],Text=[For Unix and Windows@latin1(174), the base name is the |
| 536 |
portion of the simple name preceding the rightmost period (except for the |
| 537 |
special directory names "." and "..", whose Base_Name is "." and ".."). |
| 538 |
For example, in the simple name "RM-A-8.html", the base name is "RM-A-8".]} |
| 539 |
@end{Discussion} |
| 540 |
|
| 541 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 542 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Compose (Containing_Directory : @key{in} String := ""; |
| 543 |
Name : @key{in} String; |
| 544 |
Extension : @key{in} String := "") @key{return} String;]} |
| 545 |
@end{Example} |
| 546 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 547 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0264-1]} |
| 548 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the name of the external |
| 549 |
file with the specified |
| 550 |
Containing_Directory, Name, and Extension. If Extension is the null string, |
| 551 |
then Name is interpreted as a simple name; |
| 552 |
otherwise@Chg{Version=[3],New=[,],Old=[]} Name is interpreted as a |
| 553 |
base name. The exception Name_Error is propagated if the string given as |
| 554 |
Containing_Directory is not null and does not allow the identification of a |
| 555 |
directory, or if the string given as Extension is not null and is not a |
| 556 |
possible extension, or if the string given as Name is not a possible simple |
| 557 |
name (if Extension is null) or base name (if Extension is nonnull).]} |
| 558 |
|
| 559 |
@begin{Ramification} |
| 560 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 561 |
@ChgAdded{Version=[2],Text=[The above definition implies that if |
| 562 |
the Extension is null, for Unix and Windows@latin1(174) no '.' is added to Name.]} |
| 563 |
@end{Ramification} |
| 564 |
@begin{Discussion} |
| 565 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 566 |
@ChgAdded{Version=[2],Text=[If Name is null, Name_Error should be raised, |
| 567 |
as nothing is not a possible simple name or base name.]} |
| 568 |
|
| 569 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 570 |
@ChgAdded{Version=[2],Text=[Generally, Compose(Containing_Directory(F), |
| 571 |
Base_Name(F),Extension(F)) = F. However, this is not true on Unix or |
| 572 |
Windows@latin1(174) for file names that end with a '.'; |
| 573 |
Compose(Base_Name("Fooey."),Extension("Fooey.")) = "Fooey". |
| 574 |
This is not a problem for Windows@latin1(174), as the names have the same meaning with |
| 575 |
or without the '.', but these are different names for Unix. Thus, |
| 576 |
care needs to be taken on Unix; if Extension is null, Base_Name should |
| 577 |
be avoided. (That's not usually a problem with file names generated by a |
| 578 |
program.)]} |
| 579 |
@end{Discussion} |
| 580 |
|
| 581 |
@begin{Example} |
| 582 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0049-1]} |
| 583 |
@ChgAdded{Version=[3],Keepnext=[T],Text=[@key{function} Name_Case_Equivalence (Name : @key{in} String) @key{return} Name_Case_Kind;]} |
| 584 |
@end{Example} |
| 585 |
|
| 586 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0049-1],ARef=[AI05-0248-1]} |
| 587 |
@ChgAdded{Version=[3],Text=[Returns the file name equivalence rule for the |
| 588 |
directory containing Name. Raises Name_Error if Name is not a full name. Returns |
| 589 |
Case_Sensitive if file names that differ only in the case of letters are |
| 590 |
considered different names. If file names that differ only in the case of |
| 591 |
letters are considered the same name, then Case_Preserving is returned if |
| 592 |
names have the case of the file name used when a file is created; and |
| 593 |
Case_Insensitive is returned otherwise. Returns Unknown if the file name |
| 594 |
equivalence is not known.]} |
| 595 |
@begin{ImplNote} |
| 596 |
@ChgRef{Version=[3],Kind=[Added]} |
| 597 |
@ChgAdded{Version=[3],Text=[Unix, Linux, and their relatives are Case_Sensitive |
| 598 |
systems. Microsoft@latin1(174) Windows@latin1(174) is a Case_Preserving system |
| 599 |
(unless the rarely used POSIX mode is used). Ancient systems like CP/M and |
| 600 |
early MS-DOS were Case_Insensitive systems (file names were always in UPPER |
| 601 |
CASE). Unknown is provided in case it is impossible to tell (such as could be |
| 602 |
the case for network files).]} |
| 603 |
@end{ImplNote} |
| 604 |
@end{DescribeCode} |
| 605 |
|
| 606 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 607 |
@ChgAdded{Version=[2],Type=[Leading],Text=[The following file and directory |
| 608 |
queries and types are provided:]} |
| 609 |
|
| 610 |
@begin{DescribeCode} |
| 611 |
|
| 612 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 613 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} File_Kind @key{is} (Directory, Ordinary_File, Special_File);]} |
| 614 |
@end{Example} |
| 615 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 616 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[The type File_Kind represents the |
| 617 |
kind of file represented by an external file or directory.]} |
| 618 |
|
| 619 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 620 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} File_Size @key{is range} 0 .. @RI<implementation-defined>;]} |
| 621 |
@end{Example} |
| 622 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 623 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[The type File_Size represents the |
| 624 |
size of an external file.]} |
| 625 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The |
| 626 |
maximum value for a file size in Directories.],Old=[]}]} |
| 627 |
|
| 628 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 629 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Exists (Name : @key{in} String) @key{return} Boolean;]} |
| 630 |
@end{Example} |
| 631 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 632 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns True if an external file |
| 633 |
represented by Name exists, and False |
| 634 |
otherwise. The exception Name_Error is propagated if the string given as Name |
| 635 |
does not allow the identification of an external file (including directories |
| 636 |
and special files).]} |
| 637 |
|
| 638 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 639 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Kind (Name : @key{in} String) @key{return} File_Kind;]} |
| 640 |
@end{Example} |
| 641 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 642 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the kind of |
| 643 |
external file represented by Name. The exception |
| 644 |
Name_Error is propagated if the string given as Name does not allow the |
| 645 |
identification of an existing external file.]} |
| 646 |
|
| 647 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 648 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Size (Name : @key{in} String) @key{return} File_Size;]} |
| 649 |
@end{Example} |
| 650 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 651 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the size of the |
| 652 |
external file represented by Name. The size of |
| 653 |
an external file is the number of stream elements contained in the file. |
| 654 |
If the external file is not an ordinary file, the |
| 655 |
result is implementation-defined. The exception Name_Error is propagated if the |
| 656 |
string given as Name does not allow the identification of an existing external |
| 657 |
file. The exception Constraint_Error is propagated if the file size is not a |
| 658 |
value of type File_Size.]} |
| 659 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The |
| 660 |
result for Directories.Size for a directory or special file],Old=[]}]} |
| 661 |
@begin{Discussion} |
| 662 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 663 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[We allow raising Constraint_Error, |
| 664 |
so that an implementation for a system with 64-bit file sizes does not |
| 665 |
need to support full numerics on 64-bit integers just to implement |
| 666 |
this package. Of course, if 64-bit integers are available on such a system, |
| 667 |
they should be used when defining type File_Size.]} |
| 668 |
@end{Discussion} |
| 669 |
|
| 670 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 671 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Modification_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]} |
| 672 |
@end{Example} |
| 673 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 674 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the time that the |
| 675 |
external file represented by Name was most |
| 676 |
recently modified. If the external file is not an ordinary file, the result is |
| 677 |
implementation-defined. The exception Name_Error is propagated if the string |
| 678 |
given as Name does not allow the identification of an existing external file. |
| 679 |
The exception Use_Error is propagated if the external environment does not |
| 680 |
support reading the modification time of the file with the name given by |
| 681 |
Name (in the absence of Name_Error).]} |
| 682 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The |
| 683 |
result for Directories.Modification_Time for a directory or special file.], |
| 684 |
Old=[]}]} |
| 685 |
|
| 686 |
@end{DescribeCode} |
| 687 |
|
| 688 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 689 |
@ChgAdded{Version=[2],Type=[Leading],Text=[The following directory searching |
| 690 |
operations and types are provided:]} |
| 691 |
|
| 692 |
@begin{DescribeCode} |
| 693 |
|
| 694 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 695 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} Directory_Entry_Type @key{is limited private};]} |
| 696 |
@end{Example} |
| 697 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 698 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[The type Directory_Entry_Type represents a single item in a directory. |
| 699 |
These items can only be created by the Get_Next_Entry procedure in this |
| 700 |
package. Information about the item can be obtained from the functions declared |
| 701 |
in this package. A default-initialized object of this type is invalid; objects |
| 702 |
returned from Get_Next_Entry are valid.]} |
| 703 |
|
| 704 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 705 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} Filter_Type @key{is array} (File_Kind) @key{of} Boolean;]} |
| 706 |
@end{Example} |
| 707 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 708 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[The type Filter_Type specifies which directory entries are provided |
| 709 |
from a search operation. If the Directory component is True, directory entries |
| 710 |
representing directories are provided. If the Ordinary_File component is True, |
| 711 |
directory entries representing ordinary files are provided. If the Special_File |
| 712 |
component is True, directory entries representing special files are provided.]} |
| 713 |
|
| 714 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 715 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{type} Search_Type @key{is limited private};]} |
| 716 |
@end{Example} |
| 717 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 718 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[The type Search_Type contains the |
| 719 |
state of a directory search. A |
| 720 |
default-initialized Search_Type object has no entries available (function |
| 721 |
More_Entries returns False). Type Search_Type |
| 722 |
needs finalization@PDefn2{Term=<needs finalization>,Sec=<language-defined type>} |
| 723 |
(see @RefSecNum{Assignment and Finalization}).]} |
| 724 |
|
| 725 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 726 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Start_Search (Search : @key{in out} Search_Type; |
| 727 |
Directory : @key{in} String; |
| 728 |
Pattern : @key{in} String; |
| 729 |
Filter : @key{in} Filter_Type := (@key{others} => True));]} |
| 730 |
@end{Example} |
| 731 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 732 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0092-1],ARef=[AI05-0262-1]} |
| 733 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Starts a search |
| 734 |
in the directory named by |
| 735 |
Directory for entries matching Pattern@Chg{Version=[3],New=[ and Filter],Old=[]}. |
| 736 |
Pattern represents a pattern for matching file names. If Pattern is |
| 737 |
@Chg{Version=[3],New=[the ],Old=[]}null@Chg{Version=[3],New=[ string],Old=[]}, |
| 738 |
all items in the directory are matched; otherwise, |
| 739 |
the interpretation of Pattern is implementation-defined. Only items that match |
| 740 |
Filter will be returned. After a successful call on Start_Search, the object |
| 741 |
Search may have entries available, but it may have no entries available if no |
| 742 |
files or directories match Pattern and Filter. The exception Name_Error is |
| 743 |
propagated if the string given by Directory does not identify an existing |
| 744 |
directory, or if Pattern does not allow the identification of any possible |
| 745 |
external file or directory. The exception Use_Error is propagated if the |
| 746 |
external environment does not support the searching of the directory with the |
| 747 |
given name (in the absence of Name_Error). When Start_Search propagates |
| 748 |
Name_Error or Use_Error, the object Search will have no entries available.]} |
| 749 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The |
| 750 |
interpretation of a nonnull search pattern in Directories.],Old=[]}]} |
| 751 |
|
| 752 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 753 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} End_Search (Search : @key{in out} Search_Type);]} |
| 754 |
@end{Example} |
| 755 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 756 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Ends the search represented |
| 757 |
by Search. After a successful call on |
| 758 |
End_Search, the object Search will have no entries available.]} |
| 759 |
|
| 760 |
@begin{Ramification} |
| 761 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 762 |
@ChgAdded{Version=[2],Text=[The only way that a call to End_Search could be |
| 763 |
unsuccessful if Device_Error (see @RefSecNum{Exceptions in Input-Output}) is |
| 764 |
raised because of an underlying failure (or bug).]} |
| 765 |
@end{Ramification} |
| 766 |
|
| 767 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 768 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} More_Entries (Search : @key{in} Search_Type) @key{return} Boolean;]} |
| 769 |
@end{Example} |
| 770 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 771 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns True if more entries are |
| 772 |
available to be returned by a call |
| 773 |
to Get_Next_Entry for the specified search object, and False otherwise.]} |
| 774 |
|
| 775 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 776 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Get_Next_Entry (Search : @key{in out} Search_Type; |
| 777 |
Directory_Entry : @key{out} Directory_Entry_Type);]} |
| 778 |
@end{Example} |
| 779 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 780 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0262-1]} |
| 781 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the next Directory_Entry |
| 782 |
for the search described by Search |
| 783 |
that matches the pattern and filter. If no further matches are available, |
| 784 |
Status_Error is raised. It is implementation-defined as to whether the results |
| 785 |
returned by this @Chg{Version=[3],New=[subprogram],Old=[routine]} are altered |
| 786 |
if the contents of the directory are |
| 787 |
altered while the Search object is valid (for example, by another program). The |
| 788 |
exception Use_Error is propagated if the external environment does not support |
| 789 |
continued searching of the directory represented by Search.]} |
| 790 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@Chg{Version=[2],New=[The |
| 791 |
results of a Directories search if the contents of the directory are |
| 792 |
altered while a search is in progress.],Old=[]}]} |
| 793 |
|
| 794 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 795 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{procedure} Search ( |
| 796 |
Directory : @key{in} String; |
| 797 |
Pattern : @key{in} String; |
| 798 |
Filter : @key{in} Filter_Type := (@key{others} => True); |
| 799 |
Process : @key{not null access procedure} ( |
| 800 |
Directory_Entry : @key{in} Directory_Entry_Type));]} |
| 801 |
@end{Example} |
| 802 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 803 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0092-1],ARef=[AI05-0262-1]} |
| 804 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Searches in the directory named by |
| 805 |
Directory for entries matching Pattern@Chg{Version=[3],New=[ and Filter],Old=[]}. |
| 806 |
The subprogram designated by Process is called with each matching entry in |
| 807 |
turn. Pattern represents a pattern for matching file names. If Pattern is |
| 808 |
@Chg{Version=[3],New=[the ],Old=[]}null@Chg{Version=[3],New=[ string],Old=[]}, |
| 809 |
all items in the directory are matched; |
| 810 |
otherwise, the interpretation of Pattern is implementation-defined. Only |
| 811 |
items that match Filter will be returned. |
| 812 |
The exception Name_Error is propagated if the string given by Directory |
| 813 |
does not identify an existing directory, or if Pattern does not allow the |
| 814 |
identification of any possible external file or directory. The exception |
| 815 |
Use_Error is propagated if the external environment does not support the |
| 816 |
searching of the directory with the given name (in the absence of |
| 817 |
Name_Error).]} |
| 818 |
@Comment{The implementation-defined case is handled above.} |
| 819 |
@begin{Discussion} |
| 820 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 821 |
@ChgAdded{Version=[2],Text=[@lquotes@;In turn@rquotes means that the |
| 822 |
calls to the subprogram designated by Process are not made in parallel; |
| 823 |
they can be made in any order but must be in sequence.]} |
| 824 |
@end{Discussion} |
| 825 |
|
| 826 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 827 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Simple_Name (Directory_Entry : @key{in} Directory_Entry_Type) |
| 828 |
@key{return} String;]} |
| 829 |
@end{Example} |
| 830 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 831 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the simple external name |
| 832 |
of the external file (including |
| 833 |
directories) represented by Directory_Entry. The format of the name returned is |
| 834 |
implementation-defined. The exception Status_Error is propagated if |
| 835 |
Directory_Entry is invalid.]} |
| 836 |
|
| 837 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 838 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Full_Name (Directory_Entry : @key{in} Directory_Entry_Type) |
| 839 |
@key{return} String;]} |
| 840 |
@end{Example} |
| 841 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 842 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the full external name of |
| 843 |
the external file (including |
| 844 |
directories) represented by Directory_Entry. The format of the name returned is |
| 845 |
implementation-defined. The exception Status_Error is propagated if |
| 846 |
Directory_Entry is invalid.]} |
| 847 |
|
| 848 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 849 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Kind (Directory_Entry : @key{in} Directory_Entry_Type) |
| 850 |
@key{return} File_Kind;]} |
| 851 |
@end{Example} |
| 852 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 853 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the kind of external file |
| 854 |
represented by Directory_Entry. The |
| 855 |
exception Status_Error is propagated if Directory_Entry is invalid.]} |
| 856 |
|
| 857 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 858 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Size (Directory_Entry : @key{in} Directory_Entry_Type) |
| 859 |
@key{return} File_Size;]} |
| 860 |
@end{Example} |
| 861 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 862 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the size of the external |
| 863 |
file represented by Directory_Entry. |
| 864 |
The size of an external file is the number of stream elements contained in |
| 865 |
the file. If the external file represented by |
| 866 |
Directory_Entry is not an ordinary file, the result is implementation-defined. |
| 867 |
The exception Status_Error is propagated if Directory_Entry is invalid. The |
| 868 |
exception Constraint_Error is propagated if the file size is not a value of |
| 869 |
type File_Size.]} |
| 870 |
|
| 871 |
@begin{Example}@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 872 |
@ChgAdded{Version=[2],Keepnext=[T],Text=[@key{function} Modification_Time (Directory_Entry : @key{in} Directory_Entry_Type) |
| 873 |
@key{return} Ada.Calendar.Time;]} |
| 874 |
@end{Example} |
| 875 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 876 |
@ChgAdded{Version=[2],Type=[Trailing],Text=[Returns the time that the external |
| 877 |
file represented by Directory_Entry |
| 878 |
was most recently modified. If the external file represented by Directory_Entry |
| 879 |
is not an ordinary file, the result is implementation-defined. The exception |
| 880 |
Status_Error is propagated if Directory_Entry is invalid. The exception |
| 881 |
Use_Error is propagated if the external environment does not support |
| 882 |
reading the modification time of the file represented by Directory_Entry.]} |
| 883 |
|
| 884 |
@end{DescribeCode} |
| 885 |
|
| 886 |
@end{StaticSem} |
| 887 |
|
| 888 |
@begin{ImplReq} |
| 889 |
|
| 890 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 891 |
@ChgAdded{Version=[2],Text=[For Copy_File, if Source_Name identifies an |
| 892 |
existing external ordinary file created by a predefined Ada input-output |
| 893 |
package, and Target_Name and Form can be used in the Create operation of that |
| 894 |
input-output package with mode Out_File without raising an exception, then |
| 895 |
Copy_File shall not propagate Use_Error.]} |
| 896 |
|
| 897 |
@begin{Discussion} |
| 898 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 899 |
@ChgAdded{Version=[2],Text=[This means that Copy_File will copy any file |
| 900 |
that the Ada programmer could copy (by writing some possibly complicated |
| 901 |
Ada code).]} |
| 902 |
@end{Discussion} |
| 903 |
@end{ImplReq} |
| 904 |
|
| 905 |
@begin{ImplAdvice} |
| 906 |
|
| 907 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 908 |
@ChgAdded{Version=[2],Text=[If other information about a file |
| 909 |
(such as the owner or creation date) is available in a directory entry, |
| 910 |
the implementation |
| 911 |
should provide functions in a child package Directories.Information to |
| 912 |
retrieve it.@ChildUnit{Parent=[Ada.Directories],Child=[Information]}]} |
| 913 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 914 |
Text=[Package Directories.Information should be provided to retrieve |
| 915 |
other information about a file.]}]} |
| 916 |
|
| 917 |
@begin{ImplNote} |
| 918 |
|
| 919 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 920 |
@ChgAdded{Version=[2],Type=[Leading],Text=[For Windows@latin1(174), |
| 921 |
Directories.Information should contain at least the following routines:]} |
| 922 |
|
| 923 |
@begin{Example} |
| 924 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 925 |
@ChgAdded{Version=[2],Text=[@key{package} Ada.Directories.Information @key{is} |
| 926 |
-- @RI[System-specific directory information.] |
| 927 |
-- @RI[Version for the Microsoft@latin1(174) Windows@latin1(174) operating system.]]} |
| 928 |
|
| 929 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 930 |
@ChgAdded{Version=[2],Text=[ @key{function} Creation_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]} |
| 931 |
|
| 932 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 933 |
@ChgAdded{Version=[2],Text=[ @key{function} Last_Access_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]} |
| 934 |
|
| 935 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 936 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Read_Only (Name : @key{in} String) @key{return} Boolean;]} |
| 937 |
|
| 938 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 939 |
@ChgAdded{Version=[2],Text=[ @key{function} Needs_Archiving (Name : @key{in} String) @key{return} Boolean; |
| 940 |
-- @RI[This generally means that the file needs to be backed up.] |
| 941 |
-- @RI[The flag is only cleared by backup programs.]]} |
| 942 |
|
| 943 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 944 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Compressed (Name : @key{in} String) @key{return} Boolean;]} |
| 945 |
|
| 946 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 947 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Encrypted (Name : @key{in} String) @key{return} Boolean;]} |
| 948 |
|
| 949 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 950 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Hidden (Name : @key{in} String) @key{return} Boolean;]} |
| 951 |
|
| 952 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 953 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_System (Name : @key{in} String) @key{return} Boolean;]} |
| 954 |
|
| 955 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 956 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Offline (Name : @key{in} String) @key{return} Boolean;]} |
| 957 |
|
| 958 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 959 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Temporary (Name : @key{in} String) @key{return} Boolean;]} |
| 960 |
|
| 961 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 962 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Sparse (Name : @key{in} String) @key{return} Boolean;]} |
| 963 |
|
| 964 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 965 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Not_Indexed (Name : @key{in} String) @key{return} Boolean;]} |
| 966 |
|
| 967 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 968 |
@ChgAdded{Version=[2],Text=[ @key{function} Creation_Time (Directory_Entry : @key{in} Directory_Entry_Type) |
| 969 |
@key{return} Ada.Calendar.Time;]} |
| 970 |
|
| 971 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 972 |
@ChgAdded{Version=[2],Text=[ @key{function} Last_Access_Time (Directory_Entry : @key{in} Directory_Entry_Type) |
| 973 |
@key{return} Ada.Calendar.Time;]} |
| 974 |
|
| 975 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 976 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Read_Only (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 977 |
|
| 978 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 979 |
@ChgAdded{Version=[2],Text=[ @key{function} Needs_Archiving (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean; |
| 980 |
-- @RI[This generally means that the file needs to be backed up.] |
| 981 |
-- @RI[The flag is only cleared by backup programs.]]} |
| 982 |
|
| 983 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 984 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Compressed (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 985 |
|
| 986 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 987 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Encrypted (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 988 |
|
| 989 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 990 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Hidden (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 991 |
|
| 992 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 993 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_System (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 994 |
|
| 995 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 996 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Offline (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 997 |
|
| 998 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 999 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Temporary (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 1000 |
|
| 1001 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1002 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Sparse (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 1003 |
|
| 1004 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1005 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Not_Indexed (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 1006 |
|
| 1007 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1008 |
@ChgAdded{Version=[2],Text=[ -- @RI[Additional implementation-defined subprograms allowed here.] |
| 1009 |
@key{end} Ada.Directories.Information;]} |
| 1010 |
@end{Example} |
| 1011 |
|
| 1012 |
|
| 1013 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1014 |
@ChgAdded{Version=[2],Type=[Leading],Text=[For Unix-like systems (Unix, |
| 1015 |
POSIX, Linux, etc.), Directories.Information should contain at least the |
| 1016 |
following routines:]} |
| 1017 |
|
| 1018 |
@begin{Example} |
| 1019 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1020 |
@ChgAdded{Version=[2],Text=[@key{package} Ada.Directories.Information @key{is} |
| 1021 |
-- @RI[System-specific directory information.] |
| 1022 |
-- @RI[Unix and similar systems version.]]} |
| 1023 |
|
| 1024 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1025 |
@ChgAdded{Version=[2],Text=[ @key{function} Last_Access_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]} |
| 1026 |
|
| 1027 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1028 |
@ChgAdded{Version=[2],Text=[ @key{function} Last_Status_Change_Time (Name : @key{in} String) @key{return} Ada.Calendar.Time;]} |
| 1029 |
|
| 1030 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1031 |
@ChgAdded{Version=[2],Text=[ @key{type} Permission @key{is} |
| 1032 |
(Others_Execute, Others_Write, Others_Read, |
| 1033 |
Group_Execute, Group_Write, Group_Read, |
| 1034 |
Owner_Execute, Owner_Write, Owner_Read, |
| 1035 |
Set_Group_ID, Set_User_ID);]} |
| 1036 |
|
| 1037 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1038 |
@ChgAdded{Version=[2],Text=[ @key{type} Permission_Set_Type @key{is array} (Permission) @key{of} Boolean;]} |
| 1039 |
|
| 1040 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1041 |
@ChgAdded{Version=[2],Text=[ @key{function} Permission_Set (Name : @key{in} String) @key{return} Permission_Set_Type;]} |
| 1042 |
|
| 1043 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1044 |
@ChgAdded{Version=[2],Text=[ @key{function} Owner (Name : @key{in} String) @key{return} String; |
| 1045 |
-- @RI[Returns the image of the User_Id. If a definition of User_Id] |
| 1046 |
-- @RI[is available, an implementation-defined version of Owner] |
| 1047 |
-- @RI[returning User_Id should also be defined.]]} |
| 1048 |
|
| 1049 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1050 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1]} |
| 1051 |
@ChgAdded{Version=[2],Text=[ @key{function} Group (Name : @key{in} String) @key{return} String; |
| 1052 |
-- @RI[Returns the image of the @Chg{Version=[3],New=[Group_Id],Old=[User_Id]}. If a definition of Group_Id] |
| 1053 |
-- @RI[is available, an implementation-defined version of Group] |
| 1054 |
-- @RI[returning Group_Id should also be defined.]]} |
| 1055 |
|
| 1056 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1057 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Block_Special_File (Name : @key{in} String) @key{return} Boolean;]} |
| 1058 |
|
| 1059 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1060 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Character_Special_File (Name : @key{in} String) @key{return} Boolean;]} |
| 1061 |
|
| 1062 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1063 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_FIFO (Name : @key{in} String) @key{return} Boolean;]} |
| 1064 |
|
| 1065 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1066 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Symbolic_Link (Name : @key{in} String) @key{return} Boolean;]} |
| 1067 |
|
| 1068 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1069 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Socket (Name : @key{in} String) @key{return} Boolean;]} |
| 1070 |
|
| 1071 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1072 |
@ChgAdded{Version=[2],Text=[ @key{function} Last_Access_Time (Directory_Entry : @key{in} Directory_Entry_Type) |
| 1073 |
@key{return} Ada.Calendar.Time;]} |
| 1074 |
|
| 1075 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1076 |
@ChgAdded{Version=[2],Text=[ @key{function} Last_Status_Change_Time (Directory_Entry : @key{in} Directory_Entry_Type) |
| 1077 |
@key{return} Ada.Calendar.Time;]} |
| 1078 |
|
| 1079 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1080 |
@ChgAdded{Version=[2],Text=[ @key{function} Permission_Set (Directory_Entry : @key{in} Directory_Entry_Type) |
| 1081 |
@key{return} Permission_Set_Type;]} |
| 1082 |
|
| 1083 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1084 |
@ChgAdded{Version=[2],Text=[ @key{function} Owner (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} String; |
| 1085 |
-- @RI[See Owner above.]]} |
| 1086 |
|
| 1087 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1088 |
@ChgAdded{Version=[2],Text=[ @key{function} Group (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} String; |
| 1089 |
-- @RI[See Group above.]]} |
| 1090 |
|
| 1091 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1092 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Block_Special_File (Directory_Entry : @key{in} Directory_Entry_Type) |
| 1093 |
@key{return} Boolean;]} |
| 1094 |
|
| 1095 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1096 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Character_Special_File (Directory_Entry : @key{in} Directory_Entry_Type) |
| 1097 |
@key{return} Boolean;]} |
| 1098 |
|
| 1099 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1100 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_FIFO (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 1101 |
|
| 1102 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1103 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Symbolic_Link (Directory_Entry : @key{in} Directory_Entry_Type) |
| 1104 |
@key{return} Boolean;]} |
| 1105 |
|
| 1106 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1107 |
@ChgAdded{Version=[2],Text=[ @key{function} Is_Socket (Directory_Entry : @key{in} Directory_Entry_Type) @key{return} Boolean;]} |
| 1108 |
|
| 1109 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1110 |
@ChgAdded{Version=[2],Text=[ -- @RI[Additional implementation-defined subprograms allowed here.] |
| 1111 |
@key{end} Ada.Directories.Information;]} |
| 1112 |
@end{Example} |
| 1113 |
|
| 1114 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1115 |
@ChgAdded{Version=[2],Text=[We give these definitions to give guidance so that |
| 1116 |
every implementation for a given target is not unnecessarily different. |
| 1117 |
Implementers are encouraged to make packages for other targets as similar to |
| 1118 |
these as possible.]} |
| 1119 |
|
| 1120 |
@end{ImplNote} |
| 1121 |
|
| 1122 |
|
| 1123 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1124 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0231-1]} |
| 1125 |
@ChgAdded{Version=[2],Text=[Start_Search and Search should raise |
| 1126 |
@Chg{Version=[3],New=[Name_Error],Old=[Use_Error]} if Pattern is malformed, but |
| 1127 |
not if it could represent a file in the directory but does not actually do so.]} |
| 1128 |
|
| 1129 |
@ChgImplAdvice{Version=[3],Kind=[Revised],InitialVersion=[2], |
| 1130 |
Text=[@ChgAdded{Version=[2], |
| 1131 |
Text=[Directories.Start_Search and Directories.Search should raise |
| 1132 |
@Chg{Version=[3],New=[Name_Error],Old=[Use_Error]} for malformed patterns.]}]} |
| 1133 |
|
| 1134 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1135 |
@ChgAdded{Version=[2],Text=[Rename should be supported at least when both |
| 1136 |
New_Name and Old_Name are simple names and New_Name does not identify an |
| 1137 |
existing external file.]} |
| 1138 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1139 |
Text=[Directories.Rename should be supported at least when both New_Name and |
| 1140 |
Old_Name are simple names and New_Name does not identify an existing |
| 1141 |
external file.]}]} |
| 1142 |
|
| 1143 |
@begin{Discussion} |
| 1144 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1145 |
@ChgAdded{Version=[2],Text=[@Lquotes@;Supported@rquotes@; includes raising |
| 1146 |
an exception if either name is malformed, the file to rename doesn't exist, |
| 1147 |
insufficient permission for the operation exists, or similar problems. But |
| 1148 |
this advice requires implementations to document what they do, and tells |
| 1149 |
implementers that simply raising Use_Error isn't acceptable.]} |
| 1150 |
@end{Discussion} |
| 1151 |
|
| 1152 |
@end{ImplAdvice} |
| 1153 |
|
| 1154 |
@begin{Notes} |
| 1155 |
|
| 1156 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1157 |
@ChgAdded{Version=[2],Text=[The operations Containing_Directory, |
| 1158 |
Full_Name, Simple_Name, |
| 1159 |
Base_Name, Extension, and Compose operate on file names, not external files. |
| 1160 |
The files identified by these operations do not need to exist. Name_Error is |
| 1161 |
raised only if the file name is malformed and cannot possibly identify a file. |
| 1162 |
Of these operations, only the result of Full_Name depends on the current |
| 1163 |
default directory; the result of the others depends only on their parameters.]} |
| 1164 |
|
| 1165 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1166 |
@ChgAdded{Version=[2],Text=[Using access types, values of Search_Type and |
| 1167 |
Directory_Entry_Type can be |
| 1168 |
saved and queried later. However, another task or application can modify or |
| 1169 |
delete the file represented by a Directory_Entry_Type value or the directory |
| 1170 |
represented by a Search_Type value; such a value can only give the information |
| 1171 |
valid at the time it is created. Therefore, long-term storage of these values |
| 1172 |
is not recommended.]} |
| 1173 |
|
| 1174 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1175 |
@ChgAdded{Version=[2],Text=[If the target system does not support directories |
| 1176 |
inside of directories, then Kind will never return Directory and |
| 1177 |
Containing_Directory will always raise Use_Error.]} |
| 1178 |
|
| 1179 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1180 |
@ChgAdded{Version=[2],Text=[If the target system does not support creation or |
| 1181 |
deletion of directories, then Create_Directory, Create_Path, Delete_Directory, |
| 1182 |
and Delete_Tree will always propagate Use_Error.]} |
| 1183 |
|
| 1184 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1185 |
@ChgAdded{Version=[2],Text=[To move a file or directory to a different |
| 1186 |
location, use Rename. Most target systems will allow renaming of files from one |
| 1187 |
directory to another. If the target file or directory might already exist, it |
| 1188 |
should be deleted first.]} |
| 1189 |
@begin{Discussion} |
| 1190 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1191 |
@ChgAdded{Version=[2],Type=[Leading],Text=[While Rename is only guaranteed to |
| 1192 |
work for name changes within a single directory, its unlikely that |
| 1193 |
implementers would purposely prevent functionality present in the underlying |
| 1194 |
system from working. To move a file totally portably, it's necessary to |
| 1195 |
handle failure of the Rename and fall back to Copy_File and Delete:]} |
| 1196 |
@begin{Example} |
| 1197 |
@ChgAdded{Version=[2],Text=[@key[begin] |
| 1198 |
Rename (Source, Target); |
| 1199 |
@key[exception] |
| 1200 |
@key[when] Use_Error => |
| 1201 |
Copy_File (Source, Target); |
| 1202 |
Delete (Source); |
| 1203 |
@key[end];]} |
| 1204 |
@end{Example} |
| 1205 |
@end{Discussion} |
| 1206 |
@end{Notes} |
| 1207 |
|
| 1208 |
@begin{Extend95} |
| 1209 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00248-01]} |
| 1210 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 1211 |
Package Ada.Directories is new.]} |
| 1212 |
@end{Extend95} |
| 1213 |
|
| 1214 |
@begin{Inconsistent2005} |
| 1215 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0231-1]} |
| 1216 |
@ChgAdded{Version=[3],Text=[@Defn{inconsistencies with Ada 2005}@b<Correction>: |
| 1217 |
Clarified when and which |
| 1218 |
exceptions are raised for Start_Search, Search, Delete_Directory, and |
| 1219 |
Rename. If an implementation followed the original incorrect wording, it might |
| 1220 |
raise Use_Error instead of Name_Error for Start_Search and Search, |
| 1221 |
Name_Error instead of Use_Error for Rename, and might have deleted a |
| 1222 |
nonempty directory instead of raising Use_Error for Delete_Directory. |
| 1223 |
The first two cases are very unlikely to matter in practice, and it unlikely |
| 1224 |
that an implementation would have followed the latter implementation |
| 1225 |
strategy, as it would be more work and would make Delete_Directory |
| 1226 |
identical to Delete_Tree (which is obvious nonsense).]} |
| 1227 |
@end{Inconsistent2005} |
| 1228 |
|
| 1229 |
@begin{Incompatible2005} |
| 1230 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1]} |
| 1231 |
@ChgAdded{Version=[3],Text=[@Defn{incompatibilities with Ada 2005} |
| 1232 |
A new enumeration type Name_Case_Kind and a new function |
| 1233 |
Name_Case_Equivalence is added to Directories. If Directories |
| 1234 |
is referenced in a @nt{use_clause}, and an |
| 1235 |
entity @i<E> with a @nt{defining_identifier} of one of the new entities is |
| 1236 |
defined in a package that is also referenced in a @nt{use_clause}, the entity |
| 1237 |
@i<E> may no longer be use-visible, resulting in errors. This should be rare |
| 1238 |
and is easily fixed if it does occur.]} |
| 1239 |
@end{Incompatible2005} |
| 1240 |
|
| 1241 |
@begin{Diffword2005} |
| 1242 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0271-1]} |
| 1243 |
@ChgAdded{Version=[3],Text=[@b<Correction:> We now explicitly say that |
| 1244 |
the behavior of Create_Path and Copy_File is unspecified when Use_Error |
| 1245 |
is raised. Nothing has changed here, as the behavior was (implicitly) |
| 1246 |
unspecified in the 2007 Amendment.]} |
| 1247 |
@end{Diffword2005} |
| 1248 |
|
| 1249 |
|
| 1250 |
|
| 1251 |
@LabeledAddedSubClause{Version=[3],Name=[The Package Directories.Hierarchical_File_Names]} |
| 1252 |
|
| 1253 |
@begin{Intro} |
| 1254 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1]} |
| 1255 |
@ChgAdded{Version=[3],Text=[The library package Directories.Hierarchical_File_Names is an optional package |
| 1256 |
providing operations for file name construction and decomposition for |
| 1257 |
targets with hierarchical file naming.]} |
| 1258 |
@end{Intro} |
| 1259 |
|
| 1260 |
@begin{StaticSem} |
| 1261 |
|
| 1262 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1]} |
| 1263 |
@ChgAdded{Version=[3],Type=[Leading],Text=[If provided, the library package |
| 1264 |
Directories.Hierarchical_File_Names has the following declaration:]} |
| 1265 |
|
| 1266 |
@begin{Example} |
| 1267 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1268 |
@ChgAdded{Version=[3],Text=[@key{package} Ada.Directories.Hierarchical_File_Names @key{is}@ChildUnit{Parent=[Ada.Directories],Child=[Hierarchical_File_Names]}]} |
| 1269 |
|
| 1270 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1271 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Is_Simple_Name} (Name : @key{in} String) @key{return} Boolean;]} |
| 1272 |
|
| 1273 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1274 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Is_Root_Directory_Name} (Name : @key{in} String) @key{return} Boolean;]} |
| 1275 |
|
| 1276 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1277 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Is_Parent_Directory_Name} (Name : @key{in} String) @key{return} Boolean;]} |
| 1278 |
|
| 1279 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1280 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Is_Current_Directory_Name} (Name : @key{in} String) @key{return} Boolean;]} |
| 1281 |
|
| 1282 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1283 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Is_Full_Name} (Name : @key{in} String) @key{return} Boolean;]} |
| 1284 |
|
| 1285 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1286 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Is_Relative_Name} (Name : @key{in} String) @key{return} Boolean;]} |
| 1287 |
|
| 1288 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1289 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Simple_Name} (Name : @key{in} String) @key{return} String |
| 1290 |
@key{renames} Ada.Directories.Simple_Name;]} |
| 1291 |
|
| 1292 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1293 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Containing_Directory} (Name : @key{in} String) @key{return} String |
| 1294 |
@key{renames} Ada.Directories.Containing_Directory;]} |
| 1295 |
|
| 1296 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1297 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Initial_Directory} (Name : @key{in} String) @key{return} String;]} |
| 1298 |
|
| 1299 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1300 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Relative_Name} (Name : @key{in} String) @key{return} String;]} |
| 1301 |
|
| 1302 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1303 |
@ChgAdded{Version=[3],Text=[ @key{function} @AdaSubDefn{Compose} (Directory : @key{in} String := ""; |
| 1304 |
Relative_Name : @key{in} String; |
| 1305 |
Extension : @key{in} String := "") @key{return} String;]} |
| 1306 |
|
| 1307 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1308 |
@ChgAdded{Version=[3],Text=[@key{end} Ada.Directories.Hierarchical_File_Names;]} |
| 1309 |
@end{Example} |
| 1310 |
|
| 1311 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1],ARef=[AI05-0269-1]} |
| 1312 |
@ChgAdded{Version=[3],Text=[In addition to the operations provided in package |
| 1313 |
Directories.Hierarchical_File_Names, the operations in package Directories can |
| 1314 |
be used with hierarchical file names. In particular, functions Full_Name, |
| 1315 |
Base_Name, and Extension provide additional capabilities for hierarchical |
| 1316 |
file names.]} |
| 1317 |
|
| 1318 |
@begin{DescribeCode} |
| 1319 |
@begin{Example} |
| 1320 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1321 |
@ChgAdded{Version=[3],Text=[@key{function} Is_Simple_Name (Name : @key{in} String) @key{return} Boolean;]} |
| 1322 |
@end{Example} |
| 1323 |
|
| 1324 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1325 |
@ChgAdded{Version=[3],Text=[Returns True if Name is a simple name, and returns |
| 1326 |
False otherwise.]} |
| 1327 |
|
| 1328 |
@begin{Example} |
| 1329 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1330 |
@ChgAdded{Version=[3],Text=[@key{function} Is_Root_Directory_Name (Name : @key{in} String) @key{return} Boolean;]} |
| 1331 |
@end{Example} |
| 1332 |
|
| 1333 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1334 |
@ChgAdded{Version=[3],Text=[Returns True if Name is syntactically a root (a |
| 1335 |
directory that cannot be decomposed further), and returns False otherwise.]} |
| 1336 |
|
| 1337 |
@begin{ImplNote} |
| 1338 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1339 |
@ChgAdded{Version=[3],Text=[For Unix and Unix-like systems, "/" is the root. |
| 1340 |
For Windows, "C:\" and "\\Computer\Share" are roots.]} |
| 1341 |
@end{ImplNote} |
| 1342 |
|
| 1343 |
@begin{Example} |
| 1344 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1345 |
@ChgAdded{Version=[3],Text=[@key{function} Is_Parent_Directory_Name (Name : @key{in} String) @key{return} Boolean;]} |
| 1346 |
@end{Example} |
| 1347 |
|
| 1348 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1349 |
@ChgAdded{Version=[3],Text=[Returns True if Name can be used to indicate |
| 1350 |
symbolically the parent directory of any directory, and returns False |
| 1351 |
otherwise.]} |
| 1352 |
|
| 1353 |
@begin{ImplNote} |
| 1354 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1355 |
@ChgAdded{Version=[3],Text=[Is_Parent_Directory_Name returns True if and only |
| 1356 |
if Name is ".." for both Unix and Windows.]} |
| 1357 |
@end{ImplNote} |
| 1358 |
|
| 1359 |
@begin{Example} |
| 1360 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1361 |
@ChgAdded{Version=[3],Text=[@key{function} Is_Current_Directory_Name (Name : @key{in} String) @key{return} Boolean;]} |
| 1362 |
@end{Example} |
| 1363 |
|
| 1364 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1365 |
@ChgAdded{Version=[3],Text=[Returns True if Name can be used to indicate |
| 1366 |
symbolically the directory itself for any directory, and returns False |
| 1367 |
otherwise.]} |
| 1368 |
|
| 1369 |
@begin{ImplNote} |
| 1370 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1371 |
@ChgAdded{Version=[3],Text=[Is_Current_Directory_Name returns True if and only |
| 1372 |
if Name is "." for both Unix and Windows.]} |
| 1373 |
@end{ImplNote} |
| 1374 |
|
| 1375 |
@begin{Example} |
| 1376 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1377 |
@ChgAdded{Version=[3],Text=[@key{function} Is_Full_Name (Name : @key{in} String) @key{return} Boolean;]} |
| 1378 |
@end{Example} |
| 1379 |
|
| 1380 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1381 |
@ChgAdded{Version=[3],Text=[Returns True if the leftmost directory part of Name |
| 1382 |
is a root, and returns False otherwise.]} |
| 1383 |
|
| 1384 |
@begin{Example} |
| 1385 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1386 |
@ChgAdded{Version=[3],Text=[@key{function} Is_Relative_Name (Name : @key{in} String) @key{return} Boolean;]} |
| 1387 |
@end{Example} |
| 1388 |
|
| 1389 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1],ARef=[AI05-0269-1]} |
| 1390 |
@ChgAdded{Version=[3],Text=[Returns True if Name allows the identification of an |
| 1391 |
external file (including directories and special files) but is not a full name, |
| 1392 |
and returns False otherwise.]} |
| 1393 |
|
| 1394 |
@begin{Ramification} |
| 1395 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1396 |
@ChgAdded{Version=[3],Text=[Relative names include simple names as a special case. |
| 1397 |
This function returns False if the syntax of the name is incorrect.]} |
| 1398 |
@end{Ramification} |
| 1399 |
|
| 1400 |
@begin{Example} |
| 1401 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1402 |
@ChgAdded{Version=[3],Text=[@key{function} Initial_Directory (Name : @key{in} String) @key{return} String;]} |
| 1403 |
@end{Example} |
| 1404 |
|
| 1405 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1],ARef=[AI05-0248-1]} |
| 1406 |
@ChgAdded{Version=[3],Text=[Returns the leftmost directory |
| 1407 |
part in Name. @Redundant[That is, it returns a root directory name (for a full |
| 1408 |
name), or one of a parent directory name, a current directory name, or a simple |
| 1409 |
name (for a relative name).] The exception Name_Error is propagated if the |
| 1410 |
string given as Name does not allow the identification of an external file |
| 1411 |
(including directories and special files).]} |
| 1412 |
|
| 1413 |
@begin{Example} |
| 1414 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1415 |
@ChgAdded{Version=[3],Text=[@key{function} Relative_Name (Name : @key{in} String) @key{return} String;]} |
| 1416 |
@end{Example} |
| 1417 |
|
| 1418 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1419 |
@ChgAdded{Version=[3],Text=[Returns the entire file name except |
| 1420 |
the Initial_Directory portion. The exception Name_Error is propagated if the |
| 1421 |
string given as Name does not allow the identification of an external file |
| 1422 |
(including directories and special files), or if Name has a single part (this |
| 1423 |
includes if any of Is_Simple_Name, Is_Root_Directory_Name, |
| 1424 |
Is_Parent_Directory_Name, or Is_Current_Directory_Name are True).]} |
| 1425 |
|
| 1426 |
@begin{Ramification} |
| 1427 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1428 |
@ChgAdded{Version=[3],Text=[The result might be a simple name.]} |
| 1429 |
@end{Ramification} |
| 1430 |
|
| 1431 |
@begin{Example} |
| 1432 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1433 |
@ChgAdded{Version=[3],Text=[@key{function} Compose (Directory : @key{in} String := ""; |
| 1434 |
Relative_Name : @key{in} String; |
| 1435 |
Extension : @key{in} String := "") @key{return} String;]} |
| 1436 |
@end{Example} |
| 1437 |
|
| 1438 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1439 |
@ChgAdded{Version=[3],Text=[Returns the name of the external file with the |
| 1440 |
specified Directory, Relative_Name, and Extension. The exception Name_Error is |
| 1441 |
propagated if the string given as Directory is not the null string and does |
| 1442 |
not allow the identification of a directory, or if Is_Relative_Name |
| 1443 |
(Relative_Name) is False, or if the string given as Extension is not the null |
| 1444 |
string and is not a possible extension, or if Extension is not the null string |
| 1445 |
and Simple_Name (Relative_Name) is not a base name.]} |
| 1446 |
|
| 1447 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1448 |
@ChgAdded{Version=[3],Text=[The result of Compose is a full name if Is_Full_Name |
| 1449 |
(Directory) is True; result is a relative name otherwise.]} |
| 1450 |
|
| 1451 |
@begin{Ramification} |
| 1452 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1453 |
@ChgAdded{Version=[3],Text=[Name_Error is raised by Compose if Directory is |
| 1454 |
not the null string, and both Is_Full_Name and Is_Relative_Name return |
| 1455 |
False.]} |
| 1456 |
@end{Ramification} |
| 1457 |
|
| 1458 |
@begin{Discussion} |
| 1459 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1460 |
@ChgAdded{Version=[3],Text=[A common security problem is to include a parent |
| 1461 |
directory name in the middle of a file name; this is often used to navigate |
| 1462 |
outside of an intended root directory. We considered attempting to prevent |
| 1463 |
that case by having Compose detect it and raise an exception. But the extra |
| 1464 |
rules necessary were more confusing than helpful.]} |
| 1465 |
|
| 1466 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1467 |
@ChgAdded{Version=[3],Text=[We can say more about the details of these |
| 1468 |
operations by adopting the notation of a subscript to specify how many path |
| 1469 |
fragments a particular result has. Then, we can abbreviate "Full Name" as |
| 1470 |
"Full" and "Relative Name" as "Rel". In this notation, Unix file name "a/b" is |
| 1471 |
a Rel(2), "../c/d" is a Rel(3), and "/a/b" is a Full(2). Rel(1) is equivalent |
| 1472 |
to a simple name; thus we don't have to describe that separately.]} |
| 1473 |
|
| 1474 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1475 |
@ChgAdded{Version=[3],Type=[Leading],Text=[In this notation,]} |
| 1476 |
@begin{Example} |
| 1477 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1478 |
@ChgAdded{Version=[3],Text=[For N>1, |
| 1479 |
Containing_Directory(Rel(N)) = Leftmost Rel(N-1), |
| 1480 |
Containing_Directory(Full(N)) = Leftmost Full(N-1), |
| 1481 |
Else if N = 1, raise Name_Error.]} |
| 1482 |
@end{Example} |
| 1483 |
|
| 1484 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1485 |
@ChgAdded{Version=[3],Type=[Leading],Text=[Similarly,]} |
| 1486 |
@begin{Example} |
| 1487 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1488 |
@ChgAdded{Version=[3],Text=[For N>1, |
| 1489 |
Relative_Name(Rel(N)) = Rightmost Rel(N-1), |
| 1490 |
Relative_Name(Full(N)) = Rightmost Full(N-1), |
| 1491 |
Else if N = 1, raise Name_Error.]} |
| 1492 |
@end{Example} |
| 1493 |
|
| 1494 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1495 |
@ChgAdded{Version=[3],Type=[Leading],Text=[Finally, for Compose (ignoring the extension here):]} |
| 1496 |
@begin{Example} |
| 1497 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1498 |
@ChgAdded{Version=[3],Text=[Compose (Directory => Full(N), Relative_Name => Rel(M)) => Full(N+M) |
| 1499 |
Compose (Directory => Rel(N), Relative_Name => Rel(M)) => Rel(N+M) |
| 1500 |
Name_Error if Relative_Name is a Full(M).]} |
| 1501 |
@end{Example} |
| 1502 |
|
| 1503 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1504 |
@ChgAdded{Version=[3],Text=[We didn't try to write wording to reflect these |
| 1505 |
details of these functions.]} |
| 1506 |
@end{Discussion} |
| 1507 |
|
| 1508 |
@end{DescribeCode} |
| 1509 |
@end{StaticSem} |
| 1510 |
|
| 1511 |
@begin{ImplAdvice} |
| 1512 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1]} |
| 1513 |
@ChgAdded{Version=[3],Text=[Directories.Hierarchical_File_Names should be |
| 1514 |
provided for systems with hierarchical file naming, and should not be provided |
| 1515 |
on other systems.]} |
| 1516 |
@ChgImplAdvice{Version=[3],Kind=[AddedNormal],Text=[@ChgAdded{Version=[3], |
| 1517 |
Text=[Directories.Hierarchical_File_Names should be |
| 1518 |
provided for systems with hierarchical file naming, and should not be provided |
| 1519 |
on other systems.]}]} |
| 1520 |
|
| 1521 |
@begin{ImplNote} |
| 1522 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1523 |
@ChgAdded{Version=[3],Text=[This package should be provided when targeting |
| 1524 |
Microsoft@latin1(174) Windows@latin1(174), Unix, Linux, and most Unix-like |
| 1525 |
systems.]} |
| 1526 |
@end{ImplNote} |
| 1527 |
|
| 1528 |
@end{ImplAdvice} |
| 1529 |
|
| 1530 |
|
| 1531 |
@begin{Notes} |
| 1532 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1]} |
| 1533 |
@ChgAdded{Version=[3],Text=[These operations operate on file names, not external |
| 1534 |
files. The files identified by these operations do not need to exist. Name_Error |
| 1535 |
is raised only as specified or if the file name is malformed and cannot possibly |
| 1536 |
identify a file. The result of these operations depends only on their |
| 1537 |
parameters.]} |
| 1538 |
|
| 1539 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1]} |
| 1540 |
@ChgAdded{Version=[3],Text=[Containing_Directory raises Use_Error if Name does |
| 1541 |
not have a containing directory, including when any of Is_Simple_Name, |
| 1542 |
Is_Root_Directory_Name, Is_Parent_Directory_Name, or Is_Current_Directory_Name |
| 1543 |
are True.]} |
| 1544 |
|
| 1545 |
@begin{Ramification} |
| 1546 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 1547 |
@ChgAdded{Version=[3],Text=[In particular, the default directory is not used |
| 1548 |
to find the containing directory either when Is_Parent_Directory_Name or |
| 1549 |
Is_Current_Directory_Name is True. As noted above, these functions operate |
| 1550 |
purely on the syntax of the file names and do not attempt to interpret them. |
| 1551 |
If interpretation is needed, Directories.Full_Name can be to expand any |
| 1552 |
shorthands used before calling Containing_Directory.]} |
| 1553 |
@end{Ramification} |
| 1554 |
@end{Notes} |
| 1555 |
|
| 1556 |
@begin{Extend2005} |
| 1557 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0049-1]} |
| 1558 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005} |
| 1559 |
Package Ada.Directories.Hierarchical_File_Names is new.]} |
| 1560 |
@end{Extend2005} |
| 1561 |
|