Skip to content
Snippets Groups Projects
Commit be4a88fa authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

When not using -auto, prompt for which xtrn/*/install-xtrn.ini file to install

parent f3287026
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -436,16 +436,43 @@ for (var i = 0; i < argc; i++) { ...@@ -436,16 +436,43 @@ for (var i = 0; i < argc; i++) {
ini_list.push(argv[i]); ini_list.push(argv[i]);
} }
function find_startup_dir(dir)
{
for (var i=0; i < xtrn_area.prog.length; i++) {
if (xtrn_area.prog[i].startup_dir.toLowerCase() == dir.toLowerCase())
return i;
}
return -1;
}
var xtrn_dirs = fullpath(system.ctrl_dir + "../xtrn/*"); var xtrn_dirs = fullpath(system.ctrl_dir + "../xtrn/*");
if(!ini_list.length) { if(!ini_list.length) {
var dir_list = directory(xtrn_dirs); var dir_list = directory(xtrn_dirs);
for(var d in dir_list) { for(var d in dir_list) {
if(!options.overwrite && find_startup_dir(dir_list[d]))
continue;
var fname = file_getcase(dir_list[d] + ini_fname); var fname = file_getcase(dir_list[d] + ini_fname);
if(fname) if(fname)
ini_list.push(fname); ini_list.push(fname);
} }
} }
if(!options.auto && ini_list.length > 1) {
for(var i = 0; i < ini_list.length; i++) {
printf("%3d: %s\r\n", i+1, ini_list[i].substr(0, ini_list[i].length - ini_fname.length));
}
var which;
while(!which || which < 1 || which > ini_list.length) {
var str = prompt("Which or [Q]uit");
if(aborted())
exit(0);
if(str && str.toUpperCase() == 'Q')
exit(0);
which = parseInt(str, 10);
}
ini_list = [ini_list[which - 1]];
}
if(!ini_list.length) { if(!ini_list.length) {
if(options.auto) { if(options.auto) {
alert("No install files (" + ini_fname + ") found in " + xtrn_dirs); alert("No install files (" + ini_fname + ") found in " + xtrn_dirs);
...@@ -454,6 +481,8 @@ if(!ini_list.length) { ...@@ -454,6 +481,8 @@ if(!ini_list.length) {
var ini_path; var ini_path;
while (!ini_path || !file_exists(ini_path)) { while (!ini_path || !file_exists(ini_path)) {
ini_path = prompt("Location of " + ini_fname); ini_path = prompt("Location of " + ini_fname);
if(aborted())
exit(0);
if (file_isdir(ini_path)) if (file_isdir(ini_path))
ini_path = backslash(ini_path) + ini_fname; ini_path = backslash(ini_path) + ini_fname;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment