improve w3m search. do not search for w3mimgdisplay in example. fixes #119.

This commit is contained in:
Christopher Jeffrey 2015-04-04 06:56:01 -07:00
parent f6b5b8811a
commit 9105c80eb7
2 changed files with 7 additions and 4 deletions

View File

@ -101,7 +101,8 @@ var icon = blessed.image({
left: 0,
width: 'shrink',
height: 'shrink',
file: __dirname + '/my-program-icon.png'
file: __dirname + '/my-program-icon.png',
search: false
});
// If our box is clicked, change the content.

View File

@ -7995,7 +7995,9 @@ function Image(options) {
if (fs.existsSync(Image.w3mdisplay)) {
Image.hasW3MDisplay = true;
} else if (options.search !== false) {
var file = findFile('/', 'w3mimgdisplay');
var file = findFile('/usr', 'w3mimgdisplay')
|| findFile('/lib', 'w3mimgdisplay')
|| findFile('/bin', 'w3mimgdisplay');
if (file) {
Image.hasW3MDisplay = true;
Image.w3mdisplay = file;
@ -8456,12 +8458,12 @@ function findFile(start, target) {
}
try {
stat = fs.statSync((dir === '/' ? '' : dir) + '/' + file);
stat = fs.lstatSync((dir === '/' ? '' : dir) + '/' + file);
} catch (e) {
stat = null;
}
if (stat && stat.isDirectory()) {
if (stat && stat.isDirectory() && !stat.isSymbolicLink()) {
out = read((dir === '/' ? '' : dir) + '/' + file);
if (out) return out;
}