check TERMINFO_DIRS correctly.

This commit is contained in:
Christopher Jeffrey 2013-08-11 23:13:28 -05:00
parent 980e65bd2c
commit 7b3557262f
1 changed files with 17 additions and 4 deletions

View File

@ -143,12 +143,16 @@ Tput.prototype.readTerminfo = function(term) {
Tput._prefix =
Tput.prototype._prefix = function(term) {
var TERMINFO = process.env.TERMINFO || ''
, TERMINFO_DIRS = process.env.TERMINFO_DIRS || ''
, HOME = process.env.HOME || '';
return (term && ~term.indexOf(path.sep) && term)
|| (term && this.terminfoFile)
|| this._tprefix(this.terminfoPrefix, term)
|| this._tprefix(process.env.TERMINFO, term)
|| this._tprefix(process.env.TERMINFO_DIRS, term)
|| this._tprefix(process.env.HOME + '/.terminfo', term)
|| this._tprefix(TERMINFO, term)
|| this._tprefix(TERMINFO_DIRS.split(':'), term)
|| this._tprefix(HOME + '/.terminfo', term)
|| this._tprefix('/usr/share/terminfo', term)
|| this._tprefix('/usr/share/lib/terminfo', term)
|| this._tprefix('/usr/lib/terminfo', term)
@ -164,7 +168,16 @@ Tput.prototype._tprefix = function(prefix, term) {
if (!prefix) return;
var file
, ch;
, ch
, i;
if (Array.isArray(prefix)) {
for (i = 0; i < prefix.length; i++) {
file = this._tprefix(prefix[i], term);
if (file) return file;
}
return;
}
if (!term) {
file = path.resolve(prefix, 'x');