Ah, I had no idea that basename was a thing. So much nicer!