try hex char representations for terminfo subdirectory. see #2.

This commit is contained in:
Christopher Jeffrey 2013-08-11 23:04:00 -05:00
parent a30d3ecbe8
commit 980e65bd2c

View File

@ -163,22 +163,41 @@ Tput._tprefix =
Tput.prototype._tprefix = function(prefix, term) {
if (!prefix) return;
var file
, ch;
if (!term) {
file = path.resolve(prefix, 'x');
try {
fs.statSync(file);
return prefix;
} catch (e) {
return;
;
}
file = path.resolve(prefix, '78');
try {
fs.statSync(file);
return prefix;
} catch (e) {
;
}
return;
}
var file = path.resolve(
prefix,
path.basename(term[0]),
path.basename(term)
);
term = path.basename(term);
file = path.resolve(prefix, term[0], term);
try {
fs.statSync(file);
return file;
} catch (e) {
;
}
ch = term[0].charCodeAt(0).toString(16);
if (ch.length < 2) ch = '0' + ch;
file = path.resolve(prefix, ch, term);
try {
fs.statSync(file);
return file;