File: gnatcoll-vfs_utils.ads

package info (click to toggle)
libgnatcoll 18-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 5,068 kB
  • sloc: ada: 40,393; python: 354; ansic: 310; makefile: 245; sh: 31
file content (126 lines) | stat: -rw-r--r-- 5,129 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
------------------------------------------------------------------------------
--                             G N A T C O L L                              --
--                                                                          --
--                     Copyright (C) 2009-2017, AdaCore                     --
--                                                                          --
-- This library is free software;  you can redistribute it and/or modify it --
-- under terms of the  GNU General Public License  as published by the Free --
-- Software  Foundation;  either version 3,  or (at your  option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
--                                                                          --
------------------------------------------------------------------------------

with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.OS_Lib;               use GNAT.OS_Lib;

with GNATCOLL.VFS;              use GNATCOLL.VFS;
private with GNATCOLL.Path;

package GNATCOLL.VFS_Utils is

   --------------
   -- Wrappers --
   --------------

   Local_Host_Is_Case_Sensitive : constant Boolean;

   --  These subprograms wrap around their equivalents in System.OS_Lib, and
   --  use Filesystem_String for better type safety.

   function Normalize_Pathname
     (Name           : Filesystem_String;
      Directory      : Filesystem_String  := "";
      Resolve_Links  : Boolean := True;
      Case_Sensitive : Boolean := True) return Filesystem_String;

   function Is_Absolute_Path (Name : Filesystem_String) return Boolean;

   function Is_Regular_File (Name : Filesystem_String) return Boolean;

   function Is_Directory (Name : Filesystem_String) return Boolean;

   procedure Copy_File
     (Name     : Filesystem_String;
      Pathname : Filesystem_String;
      Success  : out Boolean;
      Mode     : Copy_Mode := Copy;
      Preserve : Attribute := Time_Stamps);

   procedure Set_Writable (Name : Filesystem_String);

   procedure Set_Non_Writable (Name : Filesystem_String);

   procedure Set_Read_Only (Name : Filesystem_String) renames Set_Non_Writable;

   procedure Create_Temp_File
     (FD   : out File_Descriptor;
      Name : out Filesystem_String_Access);

   function Locate_Exec_On_Path
     (Exec_Name : Filesystem_String) return Filesystem_String_Access;

   function Locate_Regular_File
     (File_Name : Filesystem_String;
      Path      : Filesystem_String) return Filesystem_String_Access;

   --  These subprograms wrap around their equivalents in
   --  GNAT.Directory_Operations, and use Filesystem_String for better type
   --  safety.

   function File_Extension (Path : Filesystem_String) return Filesystem_String;

   function Get_Current_Dir return Filesystem_String;

   function Dir_Name (Path : Filesystem_String) return Filesystem_String;

   function Base_Name
     (Path   : Filesystem_String;
      Suffix : Filesystem_String := "") return Filesystem_String;

   procedure Change_Dir (Dir_Name : Filesystem_String);

   function Format_Pathname
     (Path  : Filesystem_String;
      Style : Path_Style := System_Default) return Filesystem_String;

   function Name_As_Directory
     (Name : Filesystem_String) return Filesystem_String;

   procedure Open (Dir : out Dir_Type; Dir_Name : Filesystem_String);

   --  These subprograms wrap around their equivalents in Ada.Directories, and
   --  use Filesystem_String for better type safety.

   function Compose
     (Containing_Directory : Filesystem_String := "";
      Name                 : Filesystem_String;
      Extension            : Filesystem_String := "") return Filesystem_String;

   ------------------------------------
   -- Remote hosts handling of Files --
   ------------------------------------

   function Is_Case_Sensitive (Host : String) return Boolean;
   --  Tell if host's filesystem is case sensitive

   function File_Equal (F1, F2 : Filesystem_String; Host : String)
                        return Boolean;

private

   Local_Host_Is_Case_Sensitive : constant Boolean :=
                                    GNATCOLL.Path.Is_Case_Sensitive
                                      (GNATCOLL.Path.Local_FS);

end GNATCOLL.VFS_Utils;