diff --git a/src/alire/alire.adb b/src/alire/alire.adb index 88857118b..6a0c23b6e 100644 --- a/src/alire/alire.adb +++ b/src/alire/alire.adb @@ -11,6 +11,8 @@ with GNATCOLL.OS.Constants; package body Alire is + package OS renames GNAT.OS_Lib; + --------- -- "=" -- --------- @@ -37,7 +39,17 @@ package body Alire is -- Check_Absolute_Path -- ------------------------- - function Check_Absolute_Path (Path : Any_Path) return Boolean is separate; + function Check_Absolute_Path (Path : Any_Path) return Boolean + is (OS.Is_Absolute_Path (Path) + and then + -- On Windows, we must ensure the path is not only absolute but + -- also that it has a drive letter. This is not checked by the + -- GNAT.OS_Lib function. + (if OS.Directory_Separator = '\' + then + (Path'Length >= 3 + and then Path (Path'First) in 'a' .. 'z' | 'A' .. 'Z' + and then Path (Path'First + 1) = ':'))); ------------- -- Err_Log -- diff --git a/src/alire/os_freebsd/alire-check_absolute_path.adb b/src/alire/os_freebsd/alire-check_absolute_path.adb deleted file mode 100644 index 01caa2a3d..000000000 --- a/src/alire/os_freebsd/alire-check_absolute_path.adb +++ /dev/null @@ -1,7 +0,0 @@ -separate (Alire) -function Check_Absolute_Path (Path : Any_Path) return Boolean is -begin - return (Path'Length >= 1 - and then - Path (Path'First) = GNAT.OS_Lib.Directory_Separator); -end Check_Absolute_Path; diff --git a/src/alire/os_linux/alire-check_absolute_path.adb b/src/alire/os_linux/alire-check_absolute_path.adb deleted file mode 100644 index 01caa2a3d..000000000 --- a/src/alire/os_linux/alire-check_absolute_path.adb +++ /dev/null @@ -1,7 +0,0 @@ -separate (Alire) -function Check_Absolute_Path (Path : Any_Path) return Boolean is -begin - return (Path'Length >= 1 - and then - Path (Path'First) = GNAT.OS_Lib.Directory_Separator); -end Check_Absolute_Path; diff --git a/src/alire/os_macos/alire-check_absolute_path.adb b/src/alire/os_macos/alire-check_absolute_path.adb deleted file mode 100644 index 01caa2a3d..000000000 --- a/src/alire/os_macos/alire-check_absolute_path.adb +++ /dev/null @@ -1,7 +0,0 @@ -separate (Alire) -function Check_Absolute_Path (Path : Any_Path) return Boolean is -begin - return (Path'Length >= 1 - and then - Path (Path'First) = GNAT.OS_Lib.Directory_Separator); -end Check_Absolute_Path; diff --git a/src/alire/os_openbsd/alire-check_absolute_path.adb b/src/alire/os_openbsd/alire-check_absolute_path.adb deleted file mode 100644 index 01caa2a3d..000000000 --- a/src/alire/os_openbsd/alire-check_absolute_path.adb +++ /dev/null @@ -1,7 +0,0 @@ -separate (Alire) -function Check_Absolute_Path (Path : Any_Path) return Boolean is -begin - return (Path'Length >= 1 - and then - Path (Path'First) = GNAT.OS_Lib.Directory_Separator); -end Check_Absolute_Path; diff --git a/src/alire/os_windows/alire-check_absolute_path.adb b/src/alire/os_windows/alire-check_absolute_path.adb deleted file mode 100644 index fb3f170d2..000000000 --- a/src/alire/os_windows/alire-check_absolute_path.adb +++ /dev/null @@ -1,10 +0,0 @@ -separate (Alire) -function Check_Absolute_Path (Path : Any_Path) return Boolean is -begin - return (Path'Length >= 3 - and then Path (Path'First) in 'A' .. 'Z' | 'a' .. 'z' - and then Path (Path'First + 1) = ':' - and then Path (Path'First + 2) in '\' | '/'); - -- Even strictly speaking, smthg like C:/ can only be an absolute path that - -- comes from some non-Windows native program (git from msys2 or the like). -end Check_Absolute_Path; diff --git a/testsuite/run.sh b/testsuite/run.sh new file mode 100755 index 000000000..4a2162365 --- /dev/null +++ b/testsuite/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +clear +python3 run.py -M1 "$@"