Supporting ./ for launching href files

This commit is contained in:
BlackLight 2011-01-08 20:10:58 +01:00
parent 3a532f2521
commit af32e05dcc

View file

@ -404,6 +404,25 @@ function blash ()
this.history.push ( this.prompt.value ); this.history.push ( this.prompt.value );
this.history_index = -1; this.history_index = -1;
if ( cmd.match ( /^\.\/(.*)$/ ))
{
file = this.expandPath ( RegExp.$1 );
for ( var i in this.files )
{
if ( this.files[i]['path'] == file )
{
if ( !this.files[i].href )
{
this.cmdOut.innerHTML = "blash: permission denied";
} else {
window.open ( this.files[i].href );
}
break;
}
}
} else {
for ( i=0; i < this.commands.length && !cmd_found; i++ ) for ( i=0; i < this.commands.length && !cmd_found; i++ )
{ {
if ( this.commands[i].name == cmd ) if ( this.commands[i].name == cmd )
@ -426,6 +445,7 @@ function blash ()
this.cmdOut.innerHTML = this.json.shellName + ": command not found: " + cmd + '<br/>'; this.cmdOut.innerHTML = this.json.shellName + ": command not found: " + cmd + '<br/>';
} }
} }
}
if ( this.auto_prompt_refresh ) if ( this.auto_prompt_refresh )
{ {