@@ -31,7 +31,7 @@ struct Table<'a> {
31
31
impl < ' a > Table < ' a > {
32
32
fn new ( path : & str , file : Option < & str > , filemode : & str , skip : Option < & ' a str > ) -> Table < ' a > {
33
33
let mut ownpath = String :: from ( path) ;
34
- if !ownpath. starts_with ( "/" ) { ownpath. insert ( 0 , '/' ) ; }
34
+ if !ownpath. is_empty ( ) && !ownpath . starts_with ( "/" ) { ownpath. insert ( 0 , '/' ) ; }
35
35
if ownpath. ends_with ( "/" ) { ownpath. pop ( ) ; }
36
36
Table {
37
37
path : ownpath,
@@ -186,7 +186,7 @@ fn add_table<'a>(rowpath: &str, outfile: Option<&str>, filemode: &str, skip: Opt
186
186
let name = col[ "name" ] . as_str ( ) . unwrap_or_else ( || fatalerr ! ( "Error: column has no 'name' entry in configuration file" ) ) ;
187
187
let colpath = col[ "path" ] . as_str ( ) . unwrap_or_else ( || fatalerr ! ( "Error: column has no 'path' entry in configuration file" ) ) ;
188
188
let mut path = String :: from ( & table. path ) ;
189
- if !colpath. starts_with ( "/" ) { path. push ( '/' ) ; }
189
+ if !colpath. is_empty ( ) && !colpath . starts_with ( "/" ) { path. push ( '/' ) ; }
190
190
path. push_str ( colpath) ;
191
191
if path. ends_with ( "/" ) { path. pop ( ) ; }
192
192
let subtable: Option < Table > = match col[ "cols" ] . is_badvalue ( ) {
@@ -353,10 +353,9 @@ fn main() {
353
353
}
354
354
continue ;
355
355
}
356
- else if path == table. path {
357
- fullcount += 1 ;
358
- }
359
- else if path. len ( ) > table. path . len ( ) {
356
+ else if path. len ( ) >= table. path . len ( ) {
357
+ if path == table. path { fullcount += 1 ; }
358
+
360
359
for i in 0 ..table. columns . len ( ) {
361
360
if path == table. columns [ i] . path { // This start tag matches one of the defined columns
362
361
0 commit comments