Some small touch-ups to plug-in code

- Use stdlib's 'pathname' to make file path manipulations slightly
  more concise.
- Add some missing comments.

Change-Id: I1da958ce7c5f528628ab3b706229b7de7f16ec62