Mercurial > hg > batmud > gmap2
changeset 314:068ea2f447cc gmap2
Add simple check for existence of the utility executables.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 11 Apr 2020 05:23:24 +0300 |
parents | 372ae2fd1db0 |
children | b5bf0757ca1f |
files | tools/makegmaps.php |
diffstat | 1 files changed, 23 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/makegmaps.php Sat Apr 11 05:11:53 2020 +0300 +++ b/tools/makegmaps.php Sat Apr 11 05:23:24 2020 +0300 @@ -201,7 +201,7 @@ else if (preg_match("/^https?:\/\/[a-zA-Z0-9]+[a-zA-Z0-9\/\.\:\-]*?\//", $sprefix) === FALSE) { - echo "Malformed URL (or atleast this silly regexp does not want it.\n"; + echo "Malformed URL (or atleast this silly regexp does not accept it.\n"; return FALSE; } else @@ -229,7 +229,28 @@ if ($cdata[0] == $level) { $def = ($cdata[1] !== FALSE) ? $cdata[1] : $cfg[$citem]; - $cfg[$citem] = stInputPrompt($cdata[2], $def, "stValidateNotEmpty"); + + $sdone = FALSE; + while (!$sdone) + { + $tmp = $cfg[$citem] = stInputPrompt($cdata[2], $def, "stValidateNotEmpty"); + + switch ($cdata[0]) + { + case 1: + exec("which ".escapeshellarg($tmp), $tmpOut, $res); + if ($res != 0) + { + echo "ERROR: Could not find '".$tmp."'. Perhaps it is not in path, or path is wrong.\n"; + } + else + $sdone = TRUE; + break; + + default: + $sdone = TRUE; + } + } } } }