comparison tools/makegmaps.php @ 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 f2c031427bb3
comparison
equal deleted inserted replaced
313:372ae2fd1db0 314:068ea2f447cc
199 return FALSE; 199 return FALSE;
200 } 200 }
201 else 201 else
202 if (preg_match("/^https?:\/\/[a-zA-Z0-9]+[a-zA-Z0-9\/\.\:\-]*?\//", $sprefix) === FALSE) 202 if (preg_match("/^https?:\/\/[a-zA-Z0-9]+[a-zA-Z0-9\/\.\:\-]*?\//", $sprefix) === FALSE)
203 { 203 {
204 echo "Malformed URL (or atleast this silly regexp does not want it.\n"; 204 echo "Malformed URL (or atleast this silly regexp does not accept it.\n";
205 return FALSE; 205 return FALSE;
206 } 206 }
207 else 207 else
208 return TRUE; 208 return TRUE;
209 } 209 }
227 foreach ($cfgDefaults as $citem => $cdata) 227 foreach ($cfgDefaults as $citem => $cdata)
228 { 228 {
229 if ($cdata[0] == $level) 229 if ($cdata[0] == $level)
230 { 230 {
231 $def = ($cdata[1] !== FALSE) ? $cdata[1] : $cfg[$citem]; 231 $def = ($cdata[1] !== FALSE) ? $cdata[1] : $cfg[$citem];
232 $cfg[$citem] = stInputPrompt($cdata[2], $def, "stValidateNotEmpty"); 232
233 $sdone = FALSE;
234 while (!$sdone)
235 {
236 $tmp = $cfg[$citem] = stInputPrompt($cdata[2], $def, "stValidateNotEmpty");
237
238 switch ($cdata[0])
239 {
240 case 1:
241 exec("which ".escapeshellarg($tmp), $tmpOut, $res);
242 if ($res != 0)
243 {
244 echo "ERROR: Could not find '".$tmp."'. Perhaps it is not in path, or path is wrong.\n";
245 }
246 else
247 $sdone = TRUE;
248 break;
249
250 default:
251 $sdone = TRUE;
252 }
253 }
233 } 254 }
234 } 255 }
235 } 256 }
236 257
237 258