Fix possibility of a maliciously crafted mod being written outside of the mods directory and thus possibily overwriting unrelated files.