check TERMINFO_DIRS correctly.
This commit is contained in:
parent
980e65bd2c
commit
7b3557262f
21
lib/tput.js
21
lib/tput.js
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue