Fix default directories
Created by: zestyr
#705 had a bug, so @kaykurokawa reverted it. The functional change of this PR is the same. I've made an attempt at improving the big if-else statement, but imo it's kinda messy and quite a bit longer than the other version. Let me know if the other version is better, or if there's another way to structure this. This also includes the two functions @kaykurokawa requested in the other PR.