Skip to content

Commit

Permalink
* Add variant of Remove_Directory_Separator for string
Browse files Browse the repository at this point in the history
  • Loading branch information
yoogx committed Nov 8, 2020
1 parent 691b841 commit 8b7495e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/backends/ocarina-backends-utils.adb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ package body Ocarina.Backends.Utils is
return Name_Find;
end Remove_Directory_Separator;

function Remove_Directory_Separator (Path : String) return String is
begin
if Path'Length >= 1 and then
Path (Path'Last) = Directory_Separator
then
return Path (Path'First .. Path'Last - 1);
end if;
return Path;
end Remove_Directory_Separator;

--------------------
-- Copy_Directory --
--------------------
Expand Down
1 change: 1 addition & 0 deletions src/backends/ocarina-backends-utils.ads
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ package Ocarina.Backends.Utils is
-- string.

function Remove_Directory_Separator (Path : Name_Id) return Name_Id;
function Remove_Directory_Separator (Path : String) return String;
-- If there is a directory separator at the end of the path, then
-- remove it and return the result. Else, return the same string.

Expand Down

1 comment on commit 8b7495e

@yoogx
Copy link
Contributor Author

@yoogx yoogx commented on 8b7495e Nov 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For #279

Please sign in to comment.