@@ -44,8 +44,13 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~path> {
44
44
dirs_to_search. push ( path ( i. to_owned ( ) ) ) ;
45
45
}
46
46
} ,
47
- // Found nothing, use the default path
48
- None => dirs_to_search. push ( path ( "/usr/share/terminfo" ) )
47
+ // Found nothing, use the default paths
48
+ // /usr/share/terminfo is the de facto location, but it seems
49
+ // Ubuntu puts it in /lib/terminfo
50
+ None => {
51
+ dirs_to_search. push ( path ( "/usr/share/terminfo" ) ) ;
52
+ dirs_to_search. push ( path ( "/lib/terminfo" ) ) ;
53
+ }
49
54
}
50
55
}
51
56
} ;
@@ -56,6 +61,11 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~path> {
56
61
if os:: path_exists ( p) && os:: path_exists ( newp) {
57
62
return Some ( newp) ;
58
63
}
64
+ // on some installations the dir is named after the hex of the char (e.g. OS X)
65
+ let newp = ~p. push_many ( & [ fmt ! ( "%x" , first_char[ 0 ] as uint) , term. to_owned ( ) ] ) ;
66
+ if os:: path_exists ( p) && os:: path_exists ( newp) {
67
+ return Some ( newp) ;
68
+ }
59
69
}
60
70
None
61
71
}
@@ -72,6 +82,7 @@ pub fn open(term: &str) -> Result<@Reader, ~str> {
72
82
#[ ignore( reason = "buildbots don't have ncurses installed and I can't mock everything I need" ) ]
73
83
fn test_get_dbpath_for_term ( ) {
74
84
// woefully inadequate test coverage
85
+ // note: current tests won't work with non-standard terminfo hierarchies (e.g. OS X's)
75
86
use std:: os:: { setenv, unsetenv} ;
76
87
fn x ( t : & str ) -> ~str { get_dbpath_for_term ( t) . expect ( "no terminfo entry found" ) . to_str ( ) } ;
77
88
assert ! ( x( "screen" ) == ~"/usr/share/terminfo/s/screen");
0 commit comments