refs #5399 simplify relative path generation (I hope it still works as expected, took me a long time to kinda understand this method). Maybe also fixes the issue.