New folder guard to stay in current folder
This commit is contained in:
@@ -62,6 +62,18 @@ package body Alire.OS_Lib is
|
||||
end return;
|
||||
end Enter_Folder;
|
||||
|
||||
----------------------------
|
||||
-- Stay_In_Current_Folder --
|
||||
----------------------------
|
||||
|
||||
function Stay_In_Current_Folder return Folder_Guard is
|
||||
begin
|
||||
return Guard : Folder_Guard (0) do
|
||||
Log ("Staying in current folder", Debug);
|
||||
Guard.Initialized := False;
|
||||
end return;
|
||||
end Stay_In_Current_Folder;
|
||||
|
||||
--------------
|
||||
-- Finalize --
|
||||
--------------
|
||||
|
||||
@@ -15,7 +15,9 @@ package Alire.OS_Lib is
|
||||
-- use this type in conjunction with Enter_Folder to ensure that
|
||||
-- the CWD is modified and restored when creating/destroying the Folder_Guard
|
||||
|
||||
function Enter_Folder (Path : String) return Folder_Guard;
|
||||
function Enter_Folder (Path : String) return Folder_Guard;
|
||||
|
||||
function Stay_In_Current_Folder return Folder_Guard;
|
||||
|
||||
function "/" (L, R : String) return String is
|
||||
(Ada.Directories.Compose (L, R));
|
||||
@@ -23,7 +25,7 @@ package Alire.OS_Lib is
|
||||
|
||||
private
|
||||
|
||||
type Folder_Guard (Original_Len : Positive) is new Ada.Finalization.Limited_Controlled with record
|
||||
type Folder_Guard (Original_Len : Natural) is new Ada.Finalization.Limited_Controlled with record
|
||||
Original : String (1 .. Original_Len);
|
||||
Initialized : Boolean := False;
|
||||
end record;
|
||||
|
||||
Reference in New Issue
Block a user