Improve OS.Compose implementation to take into account ./ in path.
[morzhol.git] / src / morzhol-os.ads
blob3c74efe99b1b687b0f4c0a92ab92c8c6492c244e
1 ------------------------------------------------------------------------------
2 -- Morzhol --
3 -- --
4 -- Copyright (C) 2007 --
5 -- Pascal Obry - Olivier Ramonat --
6 -- --
7 -- This library is free software; you can redistribute it and/or modify --
8 -- it under the terms of the GNU General Public License as published by --
9 -- the Free Software Foundation; either version 2 of the License, or (at --
10 -- your option) any later version. --
11 -- --
12 -- This library is distributed in the hope that it will be useful, but --
13 -- WITHOUT ANY WARRANTY; without even the implied warranty of --
14 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
15 -- General Public License for more details. --
16 -- --
17 -- You should have received a copy of the GNU General Public License --
18 -- along with this library; if not, write to the Free Software Foundation, --
19 -- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. --
20 ------------------------------------------------------------------------------
22 with Ada.Environment_Variables;
24 package Morzhol.OS is
26 use Ada;
28 Is_Windows : constant Boolean :=
29 Environment_Variables.Exists ("OS") and then
30 Environment_Variables.Value ("OS") = "Windows_NT";
32 Directory_Separator : constant Character;
34 function Compose (Containing_Directory, Path : in String) return String;
35 -- Returns Containing_Directory & Directory_Separator & Path if PATH is
36 -- relative, otherwise it returns Path.
38 private
40 subtype Windows_Host is Boolean;
42 type DS_Array is array (Windows_Host) of Character;
44 DS : DS_Array := DS_Array'(True => '\', False => '/');
46 Directory_Separator : constant Character := DS (Is_Windows);
48 end Morzhol.OS;