Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ada.directories [2012/01/31 21:11]
thomaslocke [Set_Directory]
ada.directories [2012/02/01 10:31] (current)
thomaslocke [Start_Search]
Line 228: Line 228:
 Perfect. Perfect.
  
-[[Ada.Directories.Create_Directory|Example Source]]+[[Ada.Directories.Create_Directory|Ada.Directories.Create_Directory ​Example Source]]
  
 ==== Delete_Directory ==== ==== Delete_Directory ====
Line 305: Line 305:
 As expected. In order to delete non-empty directories,​ you will have to use the [[Ada.Directories#​Delete_Tree | Delete_Tree]] procedure. As expected. In order to delete non-empty directories,​ you will have to use the [[Ada.Directories#​Delete_Tree | Delete_Tree]] procedure.
  
-[[Ada.Directories.Delete_Directory|Example Source]]+[[Ada.Directories.Delete_Directory|Ada.Directories.Delete_Directory ​Example Source]]
  
 ==== Create_Path ==== ==== Create_Path ====
Line 350: Line 350:
 The two exceptions, //​Name_Error//​ and //​Use_Error//,​ are raised under the same circumstances as //​Create_Directory//>​ //​Name_Error//​ if the //​New_Directory//​ string does not identify a directory, and //​Use_Error//​ if the program is not able to create any one of the directories,​ for example due to permission issues. The two exceptions, //​Name_Error//​ and //​Use_Error//,​ are raised under the same circumstances as //​Create_Directory//>​ //​Name_Error//​ if the //​New_Directory//​ string does not identify a directory, and //​Use_Error//​ if the program is not able to create any one of the directories,​ for example due to permission issues.
  
-[[Ada.Directories.Create_Path|Example Source]]+[[Ada.Directories.Create_Path|Ada.Directories.Create_Path ​Example Source]]
  
 ==== Delete_Tree ==== ==== Delete_Tree ====
Line 385: Line 385:
 Finally, it should be mentioned that //​Delete_Tree//​ looks for //​Directory//​ in the current default directory, unless an absolute path is given. Finally, it should be mentioned that //​Delete_Tree//​ looks for //​Directory//​ in the current default directory, unless an absolute path is given.
  
-[[Ada.Directories.Delete_Tree|Example Source]]+[[Ada.Directories.Delete_Tree|Ada.Directories.Delete_Tree ​Example Source]]
  
 ==== Delete_File ==== ==== Delete_File ====
Line 465: Line 465:
 And with that, we conclude our look at //​Delete_File//​. And with that, we conclude our look at //​Delete_File//​.
  
-[[Ada.Directories.Delete_File|Example Source]]+[[Ada.Directories.Delete_File|Ada.Directories.Delete_File ​Example Source]]
  
 ==== Rename ==== ==== Rename ====
Line 522: Line 522:
 Renaming files and directories just doesn'​t get any easier than this. Renaming files and directories just doesn'​t get any easier than this.
  
-[[Ada.Directories.Rename|Example Source]]+[[Ada.Directories.Rename|Ada.Directories.Rename ​Example Source]]
  
 ==== Copy_File ==== ==== Copy_File ====
Line 570: Line 570:
 //​Name_Error//​ is raised if a //​Source_Name//​ or //​Target_Name//​ does not properly identify a file. //​Use_Error//​ is raised if the action fails; the files are there, but for some other reason, copying is not possible. //​Name_Error//​ is raised if a //​Source_Name//​ or //​Target_Name//​ does not properly identify a file. //​Use_Error//​ is raised if the action fails; the files are there, but for some other reason, copying is not possible.
  
-[[Ada.Directories.Copy_File|Example Source]]+[[Ada.Directories.Copy_File|Ada.Directories.Copy_File ​Example Source]]
  
 ===== Name Operations ===== ===== Name Operations =====
Line 625: Line 625:
 As with all the other functions and procedures which depend on the current default directory, the //Name// parameter is appended to the current default directory if //Name// is relative, whereas the current default directory is ignored if //Name// is an absolute path. As with all the other functions and procedures which depend on the current default directory, the //Name// parameter is appended to the current default directory if //Name// is relative, whereas the current default directory is ignored if //Name// is an absolute path.
  
-[[Ada.Directories.Full_Name|Example Source]]+[[Ada.Directories.Full_Name|Ada.Directories.Full_Name ​Example Source]]
  
 ==== Simple_Name ==== ==== Simple_Name ====
Line 661: Line 661:
 Quite handy. Quite handy.
  
-[[Ada.Directories.Simple_Name|Example Source]]+[[Ada.Directories.Simple_Name|Ada.Directories.Simple_Name ​Example Source]]
  
 ==== Containing_Directory ==== ==== Containing_Directory ====
Line 708: Line 708:
 As expected. Notice that the //​Use_Error//​ is raised only when the given //Name// parameter does not have a containing directory. As expected. Notice that the //​Use_Error//​ is raised only when the given //Name// parameter does not have a containing directory.
  
-[[Ada.Directories.Containing_Directory|Example Source]]+[[Ada.Directories.Containing_Directory|Ada.Directories.Containing_Directory ​Example Source]]
  
 ==== Extension ==== ==== Extension ====
Line 742: Line 742:
 As you can see, if there are no extension (the foo/bar line), a null string is returned. The //​Name_Error//​ exception is raised when the //Name// parameter is malformed. As you can see, if there are no extension (the foo/bar line), a null string is returned. The //​Name_Error//​ exception is raised when the //Name// parameter is malformed.
  
-[[Ada.Directories.Extension|Example Source]]+[[Ada.Directories.Extension|Ada.Directories.Extension ​Example Source]]
  
 ==== Base_Name ==== ==== Base_Name ====
Line 788: Line 788:
 So there we have it, straight from the horse'​s mouth: If //​Base_Name//​ returns a null string, you are probably dealing with a dot file, and you will have to parse it manually. So no, you cannot expect //​Base_Name//​ to return the same results as for example the standard GNU tool //​basename//​. //​Base_Name//​ must work reliably across many platforms, thus the authors had to decide on a common, predictable,​ method. Returning a null string for dot files is just that, predictable. So there we have it, straight from the horse'​s mouth: If //​Base_Name//​ returns a null string, you are probably dealing with a dot file, and you will have to parse it manually. So no, you cannot expect //​Base_Name//​ to return the same results as for example the standard GNU tool //​basename//​. //​Base_Name//​ must work reliably across many platforms, thus the authors had to decide on a common, predictable,​ method. Returning a null string for dot files is just that, predictable.
  
-[[Ada.Directories.Base_Name|Example Source]]+[[Ada.Directories.Base_Name|Ada.Directories.Base_Name ​Example Source]]
  
 ==== Compose ==== ==== Compose ====
Line 853: Line 853:
 //Compose// is quite handy when building string paths to a file. It's a far stretch better than just concatenating the strings yourself. //Compose// is quite handy when building string paths to a file. It's a far stretch better than just concatenating the strings yourself.
  
-[[Ada.Directories.Compose|Example Source]]+[[Ada.Directories.Compose|Ada.Directories.Compose ​Example Source]]
  
 ===== File and directory queries ===== ===== File and directory queries =====
Line 901: Line 901:
 As can be seen, the current default directory is taken into account if a relative path is given and //​Name_Error//​ is raised when the given //Name// is invalid as either a file or a directory, as is the case with the empty string in the above example. Other than that, there'​s not much to say about this function. As can be seen, the current default directory is taken into account if a relative path is given and //​Name_Error//​ is raised when the given //Name// is invalid as either a file or a directory, as is the case with the empty string in the above example. Other than that, there'​s not much to say about this function.
  
-[[Ada.Directories.Exists|Example Source]]+[[Ada.Directories.Exists|Ada.Directories.Exists ​Example Source]]
  
 ==== Kind ==== ==== Kind ====
Line 945: Line 945:
 //Kind// honors the current default directory, just as all the other functions and procedures of //​Ada.Directories//​. //​Name_Error//​ is raised if the given //Name// parameter is invalid. //Kind// honors the current default directory, just as all the other functions and procedures of //​Ada.Directories//​. //​Name_Error//​ is raised if the given //Name// parameter is invalid.
  
-[[Ada.Directories.Kind|Example Source]]+[[Ada.Directories.Kind|Ada.Directories.Kind ​Example Source]]
  
 ==== Size ==== ==== Size ====
Line 975: Line 975:
 The usual //​Name_Error//​ exception applies to //Size// and you will also find a //​Constraint_Error//​ if the file size is not of type //​File_Size//,​ ie. it is either lower than 0 or higher than //​Long_Long_Integer'​Last//​. The usual //​Name_Error//​ exception applies to //Size// and you will also find a //​Constraint_Error//​ if the file size is not of type //​File_Size//,​ ie. it is either lower than 0 or higher than //​Long_Long_Integer'​Last//​.
  
-[[Ada.Directories.Size|Example Source]]+[[Ada.Directories.Size|Ada.Directories.Size ​Example Source]]
  
 ==== Modification_Time ==== ==== Modification_Time ====
Line 1010: Line 1010:
 The usual //​Name_Error//​ is raised if the file is invalid and a //​Use_Error//​ is raised if the environment doesn'​t support the notion of modification time on a file. The usual //​Name_Error//​ is raised if the file is invalid and a //​Use_Error//​ is raised if the environment doesn'​t support the notion of modification time on a file.
  
-[[Ada.Directories.Modification_Time|Example Source]]+[[Ada.Directories.Modification_Time|Ada.Directories.Modification_Time ​Example Source]]
  
 ===== Directory Searching ===== ===== Directory Searching =====
Line 1211: Line 1211:
 The //Search// procedure accepts almost the same parameters as //​Start_Search//,​ except that we have //Process// instead of //Search//. //Process// is of course access to the subprogram that is to handle each item returned by the search. This subprogram must accept one parameter: //Item : in Directory_Entry_Type//​. The //Search// procedure accepts almost the same parameters as //​Start_Search//,​ except that we have //Process// instead of //Search//. //Process// is of course access to the subprogram that is to handle each item returned by the search. This subprogram must accept one parameter: //Item : in Directory_Entry_Type//​.
  
-[[Ada.Directories.Start_Search|Example Source]]+[[Ada.Directories.Start_Search|Ada.Directories.Start_Search ​Example Source]]
  
 ==== End_Search ==== ==== End_Search ====

Navigation