/usr/share/ada/adainclude/gnatcoll/gnatcoll-vfs_utils.adb is in libgnatcoll1.6-dev 1.6gpl2014-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | ------------------------------------------------------------------------------
-- G N A T C O L L --
-- --
-- Copyright (C) 2009-2014, 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 Ada.Unchecked_Conversion;
with Ada.Directories; use Ada.Directories;
with GNATCOLL.Remote; use GNATCOLL.Remote;
with GNATCOLL.Remote.Db; use GNATCOLL.Remote.Db;
with GNATCOLL.Utils;
with GNATCOLL.VFS_Types;
package body GNATCOLL.VFS_Utils is
function Unchecked is new Ada.Unchecked_Conversion
(String_Access, Filesystem_String_Access);
------------------------
-- Normalize_Pathname --
------------------------
function Normalize_Pathname
(Name : Filesystem_String;
Directory : Filesystem_String := "";
Resolve_Links : Boolean := True;
Case_Sensitive : Boolean := True)
return Filesystem_String
is
begin
return +Normalize_Pathname
(+Name, +Directory, Resolve_Links,
Case_Sensitive);
end Normalize_Pathname;
----------------------
-- Is_Absolute_Path --
----------------------
function Is_Absolute_Path (Name : Filesystem_String) return Boolean is
begin
return Is_Absolute_Path (+Name);
end Is_Absolute_Path;
---------------------
-- Is_Regular_File --
---------------------
function Is_Regular_File (Name : Filesystem_String) return Boolean is
begin
return Is_Regular_File (+Name);
end Is_Regular_File;
------------------
-- Is_Directory --
------------------
function Is_Directory (Name : Filesystem_String) return Boolean is
begin
return Is_Directory (+Name);
end Is_Directory;
---------------
-- Copy_File --
---------------
procedure Copy_File
(Name : Filesystem_String;
Pathname : Filesystem_String;
Success : out Boolean;
Mode : Copy_Mode := Copy;
Preserve : Attribute := Time_Stamps)
is
begin
Copy_File (+Name, +Pathname, Success, Mode, Preserve);
end Copy_File;
------------------
-- Set_Writable --
------------------
procedure Set_Writable (Name : Filesystem_String) is
begin
Set_Writable (+Name);
end Set_Writable;
----------------------
-- Set_Non_Writable --
----------------------
procedure Set_Non_Writable (Name : Filesystem_String) is
begin
Set_Non_Writable (+Name);
end Set_Non_Writable;
----------------------
-- Create_Temp_File --
----------------------
procedure Create_Temp_File
(FD : out File_Descriptor;
Name : out Filesystem_String_Access)
is
R : String_Access;
begin
Create_Temp_File (FD, R);
Name := Unchecked (R);
end Create_Temp_File;
--------------------
-- File_Extension --
--------------------
function File_Extension
(Path : Filesystem_String)
return Filesystem_String
is
begin
return +File_Extension (+Path);
end File_Extension;
---------------------
-- Get_Current_Dir --
---------------------
function Get_Current_Dir return Filesystem_String is
begin
return +Get_Current_Dir;
end Get_Current_Dir;
-----------------------
-- Name_As_Directory --
-----------------------
function Name_As_Directory
(Name : Filesystem_String) return Filesystem_String is
begin
if +Name = "" then
return "";
end if;
return Filesystem_String
(GNATCOLL.Path.Ensure_Directory
(GNATCOLL.Path.Local_FS, GNATCOLL.VFS_Types.FS_String (Name)));
end Name_As_Directory;
--------------
-- Dir_Name --
--------------
function Dir_Name (Path : Filesystem_String) return Filesystem_String is
begin
return +Dir_Name (+Path);
end Dir_Name;
---------------
-- Base_Name --
---------------
function Base_Name
(Path : Filesystem_String;
Suffix : Filesystem_String := "")
return Filesystem_String
is
begin
return +Base_Name (+Path, +Suffix);
end Base_Name;
----------------
-- Change_Dir --
----------------
procedure Change_Dir (Dir_Name : Filesystem_String) is
begin
Change_Dir (+Dir_Name);
end Change_Dir;
---------------------
-- Format_Pathname --
---------------------
function Format_Pathname
(Path : Filesystem_String;
Style : Path_Style := System_Default) return Filesystem_String
is
begin
return +Format_Pathname (+Path, Style);
end Format_Pathname;
----------
-- Open --
----------
procedure Open (Dir : out Dir_Type; Dir_Name : Filesystem_String) is
begin
Open (Dir, +Dir_Name);
end Open;
-------------------------
-- Locate_Exec_On_Path --
-------------------------
function Locate_Exec_On_Path
(Exec_Name : Filesystem_String) return Filesystem_String_Access
is
Val : String_Access := Locate_Exec_On_Path (+Exec_Name);
begin
if Val /= null then
declare
Ret : constant Filesystem_String_Access :=
new Filesystem_String'(+Val.all);
begin
Free (Val);
return Ret;
end;
end if;
return null;
end Locate_Exec_On_Path;
-------------------------
-- Locate_Regular_File --
-------------------------
function Locate_Regular_File
(File_Name : Filesystem_String;
Path : Filesystem_String) return Filesystem_String_Access
is
Val : String_Access := Locate_Regular_File (+File_Name, +Path);
Ret : Filesystem_String_Access;
begin
if Val /= null then
Ret := new Filesystem_String'(+Val.all);
Free (Val);
return Ret;
else
return null;
end if;
end Locate_Regular_File;
-------------
-- Compose --
-------------
function Compose
(Containing_Directory : Filesystem_String := "";
Name : Filesystem_String;
Extension : Filesystem_String := "")
return Filesystem_String is
begin
return +Compose (+Containing_Directory, +Name, +Extension);
end Compose;
-----------------------
-- Is_Case_Sensitive --
-----------------------
function Is_Case_Sensitive (Host : String) return Boolean is
FS : GNATCOLL.VFS_Types.FS_Type;
begin
if Host = Local_Host then
FS := GNATCOLL.Path.Local_FS;
else
FS := Get_Server (Host).Shell_FS;
end if;
return GNATCOLL.Path.Is_Case_Sensitive (FS);
end Is_Case_Sensitive;
----------------
-- File_Equal --
----------------
function File_Equal (F1, F2 : Filesystem_String; Host : String)
return Boolean is
begin
return GNATCOLL.Utils.Equal (+F1, +F2, Is_Case_Sensitive (Host));
end File_Equal;
end GNATCOLL.VFS_Utils;
|