externalNodeByPath returns Node for given file path, and true, if it exists in the external files list. Otherwise returns nil, false.
(fpath string)
| 327 | // externalNodeByPath returns Node for given file path, and true, if it |
| 328 | // exists in the external files list. Otherwise returns nil, false. |
| 329 | func (ft *Tree) externalNodeByPath(fpath string) (*Node, error) { |
| 330 | ehas, i := ft.hasExternalFile(fpath) |
| 331 | if !ehas { |
| 332 | return nil, fmt.Errorf("ExtFile not found on list: %v", fpath) |
| 333 | } |
| 334 | ekid := ft.ChildByName(externalFilesName, 0) |
| 335 | if ekid == nil { |
| 336 | return nil, fmt.Errorf("ExtFile not updated -- no ExtFiles node") |
| 337 | } |
| 338 | if n := ekid.AsTree().Child(i); n != nil { |
| 339 | return AsNode(n), nil |
| 340 | } |
| 341 | return nil, fmt.Errorf("ExtFile not updated; index invalid") |
| 342 | } |
no test coverage detected