Skip to content

Commit

Permalink
Distinguish undetected exec from unknown exec name
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Feb 15, 2024
1 parent dd79711 commit ecc6c72
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/alire/alire-origins-deployers-system-unknown.ads
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package Alire.Origins.Deployers.System.Unknown is
is (Outcome_Failure ("unknown distro, no system deployer"));

overriding
function Executable_Name (This : Deployer) return String
is ("nonexistent-package-manager-that-alire-musnt-find");
function Executable_Name (This : Deployer) return String is ("");
-- Must be "" so no detection is attempted

end Alire.Origins.Deployers.System.Unknown;
6 changes: 5 additions & 1 deletion src/alire/alire-origins-deployers-system.adb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ package body Alire.Origins.Deployers.System is

function Executable_Path return Optional_Absolute_Path is
begin
return OS_Lib.Locate_Exec_On_Path (Executable_Name);
if Executable_Name /= "" then
return OS_Lib.Locate_Exec_On_Path (Executable_Name);
else
return "";
end if;
end Executable_Path;

end Alire.Origins.Deployers.System;
6 changes: 4 additions & 2 deletions src/alr/alr-commands-version.adb
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ package body Alr.Commands.Version is
.Append ("system package manager:")
.Append (if System_Manager /= ""
then System_Manager
else "not found: `"
& Origins.Deployers.System.Executable_Name & "`")
else "not found: "
& (if Origins.Deployers.System.Executable_Name /= ""
then "`" & Origins.Deployers.System.Executable_Name & "`"
else "unknown package manager"))
.New_Row;
Table
.Append ("distro detection disabled:")
Expand Down

0 comments on commit ecc6c72

Please sign in to comment.